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.

irahorecka
  • 1,447
  • 8
  • 25

1 Answers1

2

Use

df.drop_duplicates(subset='location', keep=False)
Balaji Ambresh
  • 4,977
  • 2
  • 5
  • 17