find difference between two pandas dataframes

diff_df = pd.merge(df1, df2, how='outer', indicator='Exist')

diff_df = diff_df.loc[diff_df['Exist'] != 'both']

Here is what the above code is Doing:
1. Merging the two dataframes together using an outer join. This means that all rows from both dataframes will be included in the merged dataframe.
2. Creating a new column called Exist that indicates whether the row exists in df1, df2, or both.
3. Filtering the merged dataframe to only include rows that exist in only one of the dataframes.