-1

I am super new to python. i am able to remove duplicate rows, but I need to only remove rows if they are from different pages.

this is my dataframe

name ntgs phi sw per page
bav2 0.59 0.3 0.15 1000 1
bav2 0.59 0.3 0.15 1000 3
clo_1 0.78 0.308 0.155 1509 2
clo_1 0.78 0.308 0.155 1509 2
clo_1 0.78 0.308 0.155 1509 2

this is the result I want

name ntgs phi sw per page
bav2 0.59 0.3 0.15 1000 1
clo_1 0.78 0.308 0.155 1509 2
clo_1 0.78 0.308 0.155 1509 2
clo_1 0.78 0.308 0.155 1509 2
Bstat
  • 1
  • 2

1 Answers1

0

I think what you are looking for is subset

df = df.drop_duplicates(subset=['name','page'], keep=False)

artemis
  • 6,857
  • 11
  • 46
  • 99