Advertisement

TrimwebsolutionsTrimwebsolutions

Problem and Solutions

How do I compare 2 csv files for differences Pandas in python ?

By M.K. Verma · 3 May 2022

How do I compare 2 csv files for differences  Pandas in python ?

you can try this:

df1 = pd.read_csv("file1.csv")
df2 = pd.read_csv("file2.csv")

fullDf = pd.concat([df1,df2])
fullDf = fullDf[fullDf.duplicated(keep=False) == False]
fullDf.to_csv("answer.csv", index=False)