pull_requests: 1501219392
This data as json
id | node_id | number | state | locked | title | user | body | created_at | updated_at | closed_at | merged_at | merge_commit_sha | assignee | milestone | draft | head | base | author_association | auto_merge | repo | url | merged_by |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1501219392 | PR_kwDOAMm_X85ZespA | 8143 | open | 0 | Deprecate the multi-index dimension coordinate | 4160723 | <!-- Feel free to remove check-list items aren't relevant to your change --> - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` This PR adds a `future_no_mindex_dim_coord=False` option that, if set to True, enables the future behavior of `PandasMultiIndex` (i.e., no added dimension coordinate with tuple values): ```python import xarray as xr ds = xr.Dataset(coords={"x": ["a", "b"], "y": [1, 2]}) ds.stack(z=["x", "y"]) # <xarray.Dataset> # Dimensions: (z: 4) # Coordinates: # * z (z) object MultiIndex # * x (z) <U1 'a' 'a' 'b' 'b' # * y (z) int64 1 2 1 2 # Data variables: # *empty* with xr.set_options(future_no_mindex_dim_coord=True): ds.stack(z=["x", "y"]) # <xarray.Dataset> # Dimensions: (z: 4) # Coordinates: # * x (z) <U1 'a' 'a' 'b' 'b' # * y (z) int64 1 2 1 2 # Dimensions without coordinates: z # Data variables: # *empty* ``` There are a few other things that we'll need to adapt or deprecate: - Dropping multi-index dimension coordinate *de-facto* allows having several multi-indexes along the same dimension. Normally `stack` should already take this into account, but there may be other places where this is not yet supported or where we should raise an explicit error. - Deprecate `Dataset.reorder_levels`: API is not compatible with the absence of dimension coordinate and several multi-indexes along the same dimension. I think it is OK to deprecate such edge case, which alternatively could be done by extracting the pandas index, updating it and then re-assign it to a the dataset with `assign_coords(xr.Coordinates.from_pandas_multiindex(...))` - The text-based repr: in the example above, `Dimensions without coordinate: z` doesn't make much sense - ... ? I started updating the tests, although this will be much easier once #8140 is merged. This is something that we could also easily split into multiple PRs. It is probably OK if some features are (temporarily) breaking badly when setting `future_no_mindex_dim_coord=True`. | 2023-09-04T12:32:36Z | 2023-09-04T12:32:48Z | d0709f6d90e3f71d78e562c15b1662a423d8e3e9 | 0 | 87d5bf72e766b101db32dc65e6a79957368812ee | 71177d481eb0c3547cb850a4b3e866af6d4fded7 | MEMBER | 13221727 | https://github.com/pydata/xarray/pull/8143 |
Links from other tables
- 2 rows from pull_requests_id in labels_pull_requests