YviDe
0
Q:

df remove duplicate rows

# To drop all duplicate rows:
df = df.drop_duplicates()

# To remove all rows which have a duplicate, i.e. if there are 
# two copies of a row, keep neither as opposed to one:
df = df.drop_duplicates(keep = False)

# To drop all but the first occurence of a row with each
# distinct age:
df = df.drop_duplicates(subset = 'Age', keep = 'first')

# To drop all but the last occurence of a row with each
# distinct age-height combination:
df = drop_duplicates(subset = ['Age','Height'], keep = 'last')

        
22
df = df.drop_duplicates()
5
df = df.drop_duplicates()
p
1

New to Communities?

Join the community