I have a dataframe with 3 columns. I would like to drop duplicates in column A based on values in other columns. I have searched tirelessly and cant find a solution like this.
example:
You were not very clear. I suspect you want to drop any duplicates in column A if both columns B and C are NaN. If so, please try;
df[~(df.A.duplicated(keep=False)&(df.B.isna()&df.C.isna()))]
2.1m questions
2.1m answers
60 comments
57.0k users