I am trying to find a way to achieve the below: df1 and df2 are 2 example dataframes between which I neeed to find the difference. They have the same columns, but row data can change based on new names added, old removed or data of existing set changed.
df1:
Col1 Col2 Col3 Col4 Col5
0 1 ABC 94 xxx apple
1 1 DEF 24 xxx apple
2 2 ABC 40 yyy banana
3 3 ABC 74 zzz pear
4 3 DEF 43 zzz pear
df2:
Col1 Col2 Col3 Col4 Col5
0 1 ABC 71 xxx apple
1 2 PQR 65 yyy banana
2 3 ABC 86 zzz pear
3 3 DEF 53 zzz pear
4 4 PQR 26 mmm pineapple
output:
Col1 Col2 Col3 Col4 Col5
0 1 ABC -23 xxx apple
1 1 DEF -24 xxx apple
2 2 ABC -40 yyy banana
3 2 PQR 65 yyy banana
4 3 ABC 12 zzz pear
5 3 DEF 10 zzz pear
6 4 PQR 26 mmm pineapple
I have tried this and the stackoverflow links that it mentions, but I need the change to only be applicable to specific columns only and append new rows with a new key (Col1 in my example) altogether
Thanks vm for taking a look!