home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 267521588

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
267521588 MDU6SXNzdWUyNjc1MjE1ODg= 1646 Make passing a DataArray for the xarray.concat dim argument equivalent to passing a pandas Index 8268008 open 0     8 2017-10-23T02:09:58Z 2023-01-08T08:04:40Z   NONE      

Extending from #839, if I'm concatenating some DataArrays using concat,

print(xarray.concat(data, xarray.DataArray(['foo1', 'foo2', 'foo3', 'foo4', 'foo5'], name='stat'))

I get an unnamed dimension without coordinates.

<xarray.DataArray (dim_0: 5, index: 2)> array([[ 24.841064, 0.750451], [ 24.841064, 0.750451], [ 19.062874, 0.796722], [ 14.9631 , 0.354273], [ 14.9631 , 0.354273]]) Coordinates: * index (index) object 'Intercept' 'Lvl' (dim_0) <U3 'foo1' foo2' 'foo3' 'foo4' 'foo5' Dimensions without coordinates: dim_0

Using a pandas.Index,

print(xarray.concat(data, pandas.Index(['foo1', 'foo2', 'foo3', 'foo4', 'foo5'], name='stat'))

<xarray.DataArray (stat: 5, index: 2)> array([[ 14.9631 , 0.354273], [ 19.982272, 0.555708], [ 14.974026, 0.60658 ], [ 24.841064, 0.750451], [ 24.841064, 0.750451]]) Coordinates: * index (index) object 'Intercept' 'Lvl' * stat (stat) object 'foo1' 'foo2' 'foo3' 'foo4' 'foo5'

I want the latter, not the former, but I expected the latter when using a DataArray.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1646/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 3 rows from issues_id in issues_labels
  • 8 rows from issue in issue_comments
Powered by Datasette · Queries took 0.93ms · About: xarray-datasette