I have two different CSV files – old.csv and new.csv. they are with a different number of rows and columns. the CSV files can include numbers, strings, chars, and special characters. For example:
old.csv
id round date first second third fourth fifth sixth seventh
1 2 2021.04 2 45e69 10 16 4565 37 56
2 3 2021.04 4 15 456as df924 35 4N320 78
4 5 2021.03 4 43!d9 23 26 29 33. 09
new.csv
id round date first second third fourth fifth sixth
0 1 2021.04 1 14 15 24 40 41
1 2 2021.04 2 45e69 10 16 4565 37
2 3 2021.04 4 15 456as df924 35 4N320
3 4 2021.03 10 11 20 21 24325 41
5 6 2021.03 4321 9 2#@6 28 34350 41
Now, I want to compare both csv only common rows based on ‘id’ column (row#1 and row#2) data needs to be compared and output should display difference between 2 rows only
result.csv
id round date first second third fourth fifth sixth. seventh
1 2 2021.04 2 45e69 10 16 4565 37. 56, NaN
2 3 2021.04 4 15 456as df924 35 4N320. 09,NaN
I have tried to use dataframe compare method but its not working per my need as
- It requires same number of rows and columns