home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 189721898

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
189721898 MDU6SXNzdWUxODk3MjE4OTg= 1126 unstack raises error when there is only one dimension stacked 14000880 closed 0     3 2016-11-16T14:34:05Z 2019-01-25T06:43:01Z 2019-01-25T06:43:01Z NONE      

I am aware that stack()/unstack() is meant to be used for combining/splitting multiple dimensions. Still, I wonder if it should throw an error when used on a dataset with only one dimension:

ds = xr.Dataset() ds['var'] = xr.DataArray(np.array([3., 4.]), dims=('dim1')) ds_s = ds.stack(z=['dim1']) ds_s.unstack('z') ValueError: cannot unstack a dimension that does not have a MultiIndex

I stumbled upon this when implementing a stack-groupby-apply-unstack pattern on a dataset which normally has more than one dimension to stack, but sometimes might contain only one. I can circumvent this quite easily by checking if there is only one dimension to stack and not using stack/unstack then, but I somehow expected it to work without treating this case in a special way.

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

Links from other tables

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