Deprecate the multi-index dimension coordinate #8143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
whats-new.rst
This PR adds a
future_no_mindex_dim_coord=False
option that, if set to True, enables the future behavior ofPandasMultiIndex
(i.e., no added dimension coordinate with tuple values):There are a few other things that we'll need to adapt or deprecate:
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.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 withassign_coords(xr.Coordinates.from_pandas_multiindex(...))
Dimensions without coordinate: z
doesn't make much senseI 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
.