issues: 559841620
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
559841620 | MDU6SXNzdWU1NTk4NDE2MjA= | 3748 | `swap_dims()` incorrectly changes underlying index name | 4666753 | closed | 0 | 1 | 2020-02-04T16:41:25Z | 2020-02-24T22:34:58Z | 2020-02-24T22:34:58Z | CONTRIBUTOR | MCVE Code Sample```python import xarray as xr create data array with named dimension and named coordinatex = xr.DataArray([1], {"idx": [2], "y": ("idx", [3])}, ["idx"], name="x") what's our current index? (idx, this is fine)x.indexes prints "idx: Int64Index([2], dtype='int64', name='idx')"swap dim so that y is our dimension, what's index now?x.swap_dims({"idx": "y"}).indexes prints "y: Int64Index([3], dtype='int64', name='idx')"``` The dimension name is appropriately swapped but the pandas index name is incorrect. Expected Output```python swap dim so that y is our dimension, what's index now?x.swap_dims({"idx": "y"}).indexes prints "y: Int64Index([3], dtype='int64', name='y')"``` Problem DescriptionThis is a problem because running Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3748/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |