-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Bug in loc returning multiindex in wrong oder with duplicated indexer #40987
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
Conversation
� Conflicts: � doc/source/whatsnew/v1.3.0.rst
@phofl can you rebase and will look again |
merged master |
), | ||
columns=["a"], | ||
) | ||
result = df.loc[(slice(None), indexer), :] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add this as an equivalent test: df_sliced = df.loc[df.index.isin(all_items, level=1), :]
should yield the same expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added test, but should not return the same since isin produces an boolean mask, which does not reorder the underlying dataframe. This should be the identity
thanks @phofl |
This fixes the ordering, but I am not sure if an indexer with duplicates in this case should return the same as an indexer which is unique with the same elements.