Skip to content
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

BUG: Index.drop raises on non-unique Index #38051

Closed
jbrockmendel opened this issue Nov 25, 2020 · 1 comment · Fixed by #38070
Closed

BUG: Index.drop raises on non-unique Index #38051

jbrockmendel opened this issue Nov 25, 2020 · 1 comment · Fixed by #38070
Labels
Bug Index Related to the Index class or subclasses
Milestone

Comments

@jbrockmendel
Copy link
Member

index = pd.Index(range(3)).repeat(2)

>>> index.drop(1)
Traceback (most recent call last):
[...]
pandas.errors.InvalidIndexError: Reindexing only valid with uniquely valued Index objects

It is using Index.get_indexer, which is only for uniques indexes.

@phofl
Copy link
Member

phofl commented Nov 25, 2020

Got another Problem with duplicates in MultiIndex

mi = MultiIndex.from_tuples([(1, 2), (2, 3), (1, 2)])
print(mi.drop((1, 2)))

returns an empy MultiIndex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants