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

ENH: Add first_inverted and last_inverted options to keep in DataFrame.duplicated #60394

Open
1 of 3 tasks
tommycarstensen opened this issue Nov 22, 2024 · 2 comments
Open
1 of 3 tasks
Labels
duplicated duplicated, drop_duplicates Enhancement Needs Discussion Requires discussion from core team before further action Needs Info Clarification about behavior needed to assess issue

Comments

@tommycarstensen
Copy link

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

I suggest adding options first_inverted and last_inverted as keep options to function pandas.DataFrame.duplicated. Below an example of how it would work and what it would return.

df = pd.DataFrame({
'brand': ['Yum Yum', 'Yum Yum', 'Yum Yum', 'Indomie', 'Indomie', 'Indomie'],
'style': ['cup', 'cup', 'cup', 'cup', 'pack', 'pack'],
'rating': [4, 4, 4, 3.5, 15, 5],
})

df.duplicated(keep='first_inverted')

0 True
1 False
2 False
3 False
4 False
5 False
dtype: bool

Feature Description

.

Alternative Solutions

.

Additional Context

No response

@tommycarstensen tommycarstensen added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 22, 2024
@KevsterAmp
Copy link
Contributor

take

@rhshadrach
Copy link
Member

Is this request the same as doing df.duplicated(keep=False) & ~df.duplicated(keep="first")?

@rhshadrach rhshadrach added Needs Discussion Requires discussion from core team before further action Needs Info Clarification about behavior needed to assess issue duplicated duplicated, drop_duplicates and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicated duplicated, drop_duplicates Enhancement Needs Discussion Requires discussion from core team before further action Needs Info Clarification about behavior needed to assess issue
Projects
None yet
Development

No branches or pull requests

3 participants