0

I want to remove duplicate items completely from a pandas dataframe. For example, I have the dataframe:

  location     area
0  mountain view  1044ft2
1      palo alto     None
2  mountain view   890ft2
3     san carlos  1000ft2
4        belmont     None

What I want to do is find unique values in column location and remove any items that had duplicates altogether, completely, etc.. So the final product will look like this (notice mountain view is gone):

  location     area
1      palo alto     None
3     san carlos  1000ft2
4        belmont     None

Thanks.

2
  • 1
    df.drop_duplicates('location',keep=False) Commented Jul 19, 2020 at 17:55
  • Very simple! Thanks, didn't notice a duplicate question on SO, but appreciate your help @anky Commented Jul 19, 2020 at 17:56

1 Answer 1

2

Use

df.drop_duplicates(subset='location', keep=False)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.