issues: 476103888
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
476103888 | MDU6SXNzdWU0NzYxMDM4ODg= | 3176 | DataArray.set_index throws error on documented input | 2818208 | closed | 0 | 7 | 2019-08-02T10:09:04Z | 2019-08-19T16:02:53Z | 2019-08-19T16:02:53Z | CONTRIBUTOR | Problem DescriptionDocs for
This suggests that one can set a MCVE```python In [1]: import numpy as np In [2]: import xarray as xr In [3]: arr = xr.DataArray(data=np.ones((2, 3)), dims=['x', 'y']) In [4]: arr.dims Out[4]: ('x', 'y') In [5]: arr.set_index({'x': range(2)})
KeyError KeyError: 0 ``` At first, I thought it might be because ```python In [18]: arr.coords Out[18]: Coordinates: empty In [19]: arr._coords Out[19]: OrderedDict() ``` but even if I set the coordinates first and then try to re-index, it fails:
Expected OutputI expect my MCVE to work based on the documentation. Problem SolutionMy guess is that the issue is Xarray is using the |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3176/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |