Categories
Python Answers

How to find the difference between two data frames with Python Pandas?

Spread the love

To find the difference between two data frames with Python Pandas, we can use the drop_duplicates method.

For instance, we write

pd.concat([df1,df2]).drop_duplicates(keep=False)

to combine the 2 data frames together with concat.

And then we call drop_duplicates to remove the items that are in both data frames.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *