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
Closed

DEPR: Index.get_duplicates #20239

jreback opened this issue Mar 10, 2018 · 1 comment
Milestone

Comments

@jreback
Copy link
Contributor

@jreback 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')
@joseortiz3
Copy link

@joseortiz3 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.

@jreback jreback mentioned this issue Nov 21, 2019
242 of 242 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants