issues: 1361896826
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1361896826 | I_kwDOAMm_X85RLOV6 | 6989 | reset multi-index to single index (level): coordinate not renamed | 4160723 | closed | 0 | 4160723 | 0 | 2022-09-05T12:45:22Z | 2022-09-27T10:35:39Z | 2022-09-27T10:35:39Z | MEMBER | What happened?Resetting a multi-index to a single level (i.e., a single index) does not rename the remaining level coordinate to the dimension name. What did you expect to happen?While it is certainly more consistent not to rename the level coordinate here (since an index can be assigned to a non-dimension coordinate now), it breaks from the old behavior. I think it's better not introduce any breaking change. As discussed elsewhere, we might eventually want to deprecate Minimal Complete Verifiable Example```Python import pandas as pd import xarray as xr midx = pd.MultiIndex.from_product([["a", "b"], [1, 2]], names=("foo", "bar")) ds = xr.Dataset(coords={"x": midx}) <xarray.Dataset>Dimensions: (x: 4)Coordinates:* x (x) object MultiIndex* foo (x) object 'a' 'a' 'b' 'b'* bar (x) int64 1 2 1 2Data variables:emptyrds = ds.reset_index("foo") v2022.03.0<xarray.Dataset>Dimensions: (x: 4)Coordinates:* x (x) int64 1 2 1 2foo (x) object 'a' 'a' 'b' 'b'Data variables:emptyv2022.06.0<xarray.Dataset>Dimensions: (x: 4)Coordinates:foo (x) object 'a' 'a' 'b' 'b'* bar (x) int64 1 2 1 2Dimensions without coordinates: xData variables:empty``` MVCE confirmation
Relevant log outputNo response Anything else we need to know?No response Environment |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/6989/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |