-1

I want to drop all rows that have same values by drop_duplicates(subset=['other_things','Dist_1','Dist_2']) but could not get it.

Input

  id  other_things  Dist_1  Dist_2
    1   a             a       a
    2   a             b       a
    3   10            10      10
    4   a             b       a
    5   8             12      48
    6   8             12      48

Expeted

  id  other_things  Dist_1  Dist_2
    2   a             b       a
    4   a             b       a
    5   8             12      48
    6   8             12      48

Try

df =  df.drop_duplicates() 
Jack
  • 1,724
  • 4
  • 18
  • 33

1 Answers1

0

It looks like the 'id' column could be generating problems.

Would recommend using the 'subset' parameter on drop duplicates as per the documentation.

drop_duplicates documentation1

ecortazar
  • 1,382
  • 1
  • 6
  • 12