I have 2 columns which contains duplicate entries. See example below. I want to remove duplicates from both columns Original Column
MatchN Striker
1000887 DA Warner
1000887 DA Warner
1000887 TM Head
1000887 TM Head
I would like to finally get the result as
MatchN Striker
1000887 DA Warner
1000887 TM Head
I tried using
np.df[["MatchN"],["Striker"]].unique()
but it does not work.
Can anyone please suggest best way to get to the desired result?
IIUC you need DataFrame.drop_duplicates() method:
In [69]: df = df.drop_duplicates(['MatchN','Striker'])
In [70]: df
Out[70]:
MatchN Striker
0 1000887 DA Warner
2 1000887 TM Head
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With