I have a dataframe like this:
A B C
12 true 1
12 true 1
3 nan 2
3 nan 3
I would like to delete all the rows where the value of column A will be repeated, but only if the value of column B is "true".
The resulting information frame, which I mean, is:
A B C
12 true 1
3 nan 2
3 nan 3
I tried using: df.loc[df['B']=='true'].drop_duplicates('A', inplace=True, keep='first')but it does not work.
Thank you for your help!
source
share