Skip to content

BUG: .loc with MultiIndex with tuple in level GH#27591 #42329

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 12 commits into from
Aug 8, 2021

Conversation

jbrockmendel
Copy link
Member

@attack68
Copy link
Contributor

attack68 commented Jul 1, 2021

This PR does better than existing but its still ambiguous for pathological cases - hence why I'm floating the idea of deprecating tuples as sequence identifiers for multiple keys and relying only on lists (which can't be used as index keys).

edit: actually not even doing that would solve the cases below - because nowhere is a list needed, the below depends on how the slice(None) might be automatically added or not based on implied levels.

Effect of PR

Before After
Screen Shot 2021-07-01 at 15 26 34 Screen Shot 2021-07-01 at 15 26 11

@jbrockmendel
Copy link
Member Author

hence why I'm floating the idea of deprecating tuples as sequence identifiers for multiple keys and relying only on lists (which can't be used as index keys).

I think we should do this too. This PR is about fixing the bug in the interim.

@jbrockmendel jbrockmendel added Bug Indexing Related to indexing on series/frames, not to indexes themselves MultiIndex labels Jul 1, 2021
@jreback jreback added this to the 1.4 milestone Jul 28, 2021
@jreback jreback merged commit 9db86be into pandas-dev:master Aug 8, 2021
@jreback
Copy link
Contributor

jreback commented Aug 8, 2021

thanks @jbrockmendel, looking forwards to cleanups on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves MultiIndex
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: MultiIndex Slice returns incorrect slice (compared to .xs())
3 participants