Skip to content

Conversation

@benbovy
Copy link
Member

@benbovy benbovy commented Sep 5, 2022

Restore behavior prior to the explicit indexes refactor (i.e., refactored but without breaking changes).

TODO:

  • review set_index
  • review reset_index

For reset_index, the only behavior that is not restored here is the coordinate renamed with a _ suffix when dropping a single index. This was originally to prevent any coordinate with no index matching a dimension name, which is now irrelevant. That is a quite dirty workaround and I don't know who is relying on it (no complaints yet), but I'm open to restore it if needed (esp. considering that we may later deprecate reset_index completely in favor of drop_indexes #6971).

Restore old behavior, i.e.,

- drop the multi-index dimension name (even if
  drop=False) unless reset_index still returns a multi-index
- rename the level coordinate to the dimension name if the multi-index
  is reduced to a single index
- drop the whole multi-index if its dimension coordinate is given as
  argument

Fix IndexVariable -> Variable conversion
@benbovy benbovy changed the title Review (re)set_index + tests Review (re)set_index Sep 5, 2022
@benbovy benbovy mentioned this pull request Sep 23, 2022
@benbovy
Copy link
Member Author

benbovy commented Sep 27, 2022

Let's merge this. The failing flaky tests are not related to this PR.

@benbovy benbovy merged commit a042ae6 into pydata:main Sep 27, 2022
@benbovy benbovy deleted the review-set-reset-index branch August 30, 2023 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment