two if condition and drop duplicate in data dataframe python code example Example: remove duplicates based on two columns in dataframe df.drop_duplicates(['A','B'],keep= 'last')