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

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.