I have a dataframe
>>> df
zeroa zerob zeroc zerod zeroe zero
FSi
1 10 100 a ok NaN ok
1 11 110 temp NaN NaN
2 12 120 c temp NaN NaN
3 NaN NaN NaN NaN ok NaN
I want to keep only unique indexes, as index 1 is repeating I want its second instance to be dropped, how could I do that ? I want my result as
>>> df
zeroa zerob zeroc zerod zeroe zero
FSi
1 10 100 a ok NaN ok
2 12 120 c temp NaN NaN
3 NaN NaN NaN NaN ok NaN
Without resetting the index:
df[~df.index.duplicated()]
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments