Home > Back-end >  How to get removed duplicates?
How to get removed duplicates?

Time:05-29

How to get removed duplicates Pandas after operation:

new_df.drop_duplicates()

To get specific column values by column name.

Also there is a complected condition:

df_filtered = new_dfr[filter1 & filter2 & filter3 & filter4]

I tried to get False rows using this:

df_filtered = ~new_dfr[filter1 & filter2 & filter3 & filter4]

I have tried also this:

df_filtered_false = new_dfr[~(filter1 & filter2 & filter3 & filter4)]

CodePudding user response:

IIUC, you can use pandas.DataFrame.duplicated

removed = df[df.duplicated()]
  • Related