1

I want to delete rows that have the same value in one column in pandas:

  A      B  C   D
foo1    one  0   0
foo1    two  2   4
foo2    two  4   8
foo2    one  6  12
foo2  three  7  14

Must be:

  A      B  C   D
foo1    one  0   0
foo2    two  4   8

I want to delete rows that has foo1 and foo2 and keep only one row of foo1 and foo2 (not duplicated rows, rows that has the same value in one specific column)

Thanks in advance

jojo
  • 137
  • 1
  • 3
  • 12
  • @Ardit No, I want to duplicate rows that ONLY has the same value in ONE column. – jojo Sep 24 '17 at 21:33
  • 2
    Try `df1 = df1.drop_duplicates(subset='A').reset_index(drop=True)`, use `subset` to specify the columns on which duplicates to be considered. – niraj Sep 24 '17 at 21:48

0 Answers0