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

DEPR: Index.get_duplicates #20239

Closed
jreback opened this issue Mar 10, 2018 · 1 comment · Fixed by #20544
Closed

DEPR: Index.get_duplicates #20239

jreback opened this issue Mar 10, 2018 · 1 comment · Fixed by #20544
Labels
Deprecate Functionality to remove in pandas Indexing Related to indexing on series/frames, not to indexes themselves
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Mar 10, 2018

completely duplicates (pun-intended) .duplicated / .drop_duplicates and is unecessary.

In [1]: pd.Index([1, 2, 3, 2, 3, 4, 3]).get_duplicates()
Out[1]: [2, 3]

In [2]: pd.Index([1, 2, 3, 2, 3, 4, 3]).drop_duplicates()
Out[2]: Int64Index([1, 2, 3, 4], dtype='int64')

In [3]: pd.Index([1, 2, 3, 2, 3, 4, 3]).duplicated()
Out[3]: array([False, False, False,  True,  True, False,  True])

In [4]: i = pd.Index([1, 2, 3, 2, 3, 4, 3])

In [5]: i[i.duplicated()]
Out[5]: Int64Index([2, 3, 3], dtype='int64')

In [6]: i[i.duplicated()].unique()
Out[6]: Int64Index([2, 3], dtype='int64')
@jreback jreback added Indexing Related to indexing on series/frames, not to indexes themselves Deprecate Functionality to remove in pandas Difficulty Intermediate labels Mar 10, 2018
@jreback jreback added this to the 0.23.0 milestone Mar 10, 2018
@joseortiz3
Copy link
Contributor

joseortiz3 commented Apr 30, 2019

Does this really need to be deprecated? Isn't it just a wrapper to idx[idx.duplicated()].unique(), and should therefore be extremely low-maintenance? Very inconvenient to call

idx = df.index
idx[idx.duplicated()].unique()

rather than

df.index.get_duplicates()

when your trying to see where duplicates are coming from debugging your code interactively.

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

Successfully merging a pull request may close this issue.

2 participants