I have 2 pandas dataframes which have exactly same columns. So they look something like this:
Dataframe1:
C1 C2 C3
1 A X
2 B Y
Dataframe2:
C1 C2 C3
1 A X
3 C Z
I want to find difference between these 2 dataframes. Basically i need following 3 output:
- No of same rows in 2 dataframes - "1" in this case
Rows present in dataframe1, but missing in dataframe2
2 B Y
Rows present in dataframe2, but missing in dataframe1
3 C Z
I found no of same rows as:
same_line_count = (pd.merge(df1, df2, on=['C1', 'C2', 'C3'], how='inner')).shape[0]
But I am unable to find other 2 nos.