Skip to content

Fix to_index(): return multiindex level as single index #7105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 12, 2022

Conversation

benbovy
Copy link
Member

@benbovy benbovy commented Sep 29, 2022

@dcherian
Copy link
Contributor

dcherian commented Oct 3, 2022

I like this fix in general: we fix the backwards incompatible change and work to remove MultiIndex special cases separately.

Though this PR seems to have broken a lot of things :)

@benbovy
Copy link
Member Author

benbovy commented Oct 3, 2022

Yes I agree it would be nice if we can roll back this breaking change. However, it really conflicts with .xindexes that returns the same index instance for each of its corresponding coordinate. This roll back seems to mostly break things where we need to be smart while handling multi-index coordinates passed to DataArray / Dataset constructors. This might be tricky to solve. It would probably be easier to do it after #6392.

@benbovy benbovy marked this pull request as draft October 3, 2022 21:33
Add Variable._to_index method used internally and returns
multi-index for level variables.
@benbovy
Copy link
Member Author

benbovy commented Oct 7, 2022

Tests should be ok now, although this is not a super clean workaround. IndexVariable still needs some more refactoring anyway.

@benbovy benbovy marked this pull request as ready for review October 7, 2022 12:20
@dcherian
Copy link
Contributor

Thanks @benbovy

@dcherian dcherian merged commit f93b467 into pydata:main Oct 12, 2022
@benbovy benbovy deleted the fix-to-index-midx-level branch December 8, 2022 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

groupby(multi-index level) not working correctly on a multi-indexed DataArray or DataSet
2 participants