Skip to content

[BUG]: Fix bug in MultiIndex.drop dropped nan when non existing key was given #37794

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 4 commits into from
Nov 18, 2020

Conversation

phofl
Copy link
Member

@phofl phofl commented Nov 12, 2020

Additional question:
The doc says (https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Index.drop.html) that drop raises when not all labels are found, but

pd.DataFrame(index=pd.MultiIndex.from_product([range(3), range(3)])).drop([1, 5], level=0)

does not raise, because 1 is found. Should we implement, that it raises every time when at least one of the keys is not found?

@pep8speaks
Copy link

pep8speaks commented Nov 12, 2020

Hello @phofl! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-11-13 13:20:13 UTC

@jreback jreback added the Indexing Related to indexing on series/frames, not to indexes themselves label Nov 13, 2020
@jreback jreback added this to the 1.2 milestone Nov 13, 2020
@phofl
Copy link
Member Author

phofl commented Nov 13, 2020

cc @jreback failure unrelated. Greenish

@jreback jreback merged commit 458d756 into pandas-dev:master Nov 18, 2020
@jreback
Copy link
Contributor

jreback commented Nov 18, 2020

thanks @phofl

@phofl phofl deleted the 18853 branch November 18, 2020 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

DataFrame.drop(Timestamp) on MultiIndex with NaT incorrectly drops the NaT row
3 participants