0

Based on the bellow example, how can i remove just the last "A" from the list ? By using duplicates (as i did) it deletes both entries. The end result should be: A, B, C but now i get B,C.

import pandas as pd
df = pd.DataFrame({'ID': ["A", "B", "C", "A"]})
df.drop_duplicates(keep=False,inplace=True) 
print(df)
bogdann
  • 39
  • 1
  • 8

1 Answers1

0

You just need to set parameter keep="first"