keep only one duplicate in pandas

Solutions on MaxInterview for keep only one duplicate in pandas by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "keep only one duplicate in pandas"
Clara
24 Nov 2019
1import pandas as pd
2df = pd.DataFrame({"A":["foo", "foo", "foo", "bar"], "B":[0,1,1,1], "C":["A","A","B","A"]})
3df.drop_duplicates(subset=['A', 'C'], keep=False)
4