Using Pandas, I want to compare 2 csv files. Both files have same data but in 2nd file, some rows will be deleted, some will be inserted and some will be modified. I want to compare both the files and find out the deleted, inserted and modified row.
Asked
Active
Viewed 491 times
0
-
Does this help: https://stackoverflow.com/questions/19917545/comparing-two-pandas-dataframes-for-differences – piterbarg Nov 27 '20 at 08:44
-
Thank you, I will check out . – samburnam shanmugam Nov 27 '20 at 09:42
1 Answers
0
A simple way to do this is to use:
df1[~df1.apply(tuple,1).isin(df2.apply(tuple,1))]

Serge de Gosson de Varennes
- 7,162
- 3
- 18
- 39
-
Thank you for your comment, but this shows only the difference. I want to know the inserted rows too. – samburnam shanmugam Nov 27 '20 at 09:37