issues: 490476815
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
490476815 | MDU6SXNzdWU0OTA0NzY4MTU= | 3287 | GroupBy of stacked dim with strings renames underlying dims | 1053153 | closed | 0 | 7 | 2019-09-06T18:59:47Z | 2020-03-31T16:10:10Z | 2020-03-31T16:10:10Z | CONTRIBUTOR | Names for dimensions are lost (renamed) when they are stacked and grouped, if one of the dimensions has string coordinates. ```python data = np.zeros((2,1,1)) dims = ['c', 'y', 'x'] d1 = xr.DataArray(data, dims=dims) g1 = d1.stack(f=['c', 'x']).groupby('f').first() print('Expected dim names:') print(g1.coords) print() d2 = xr.DataArray(data, dims=dims, coords={'c': ['R', 'G']}) g2 = d2.stack(f=['c', 'x']).groupby('f').first() print('Unexpected dim names:') print(g2.coords) ``` OutputIt is expected the 'f_level_0' and 'f_level_1' be 'c' and 'x', respectively in the second part below. ``` Expected dim names: Coordinates: * f (f) MultiIndex - c (f) int64 0 1 - x (f) int64 0 0 Unexpected dim names: Coordinates: * f (f) MultiIndex - f_level_0 (f) object 'G' 'R' - f_level_1 (f) int64 0 0 ``` Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3287/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |