Skip to content

Instantly share code, notes, and snippets.

@lmEshoo
Created June 20, 2016 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmEshoo/61f36e922b26d7cfaacd0194e733cfed to your computer and use it in GitHub Desktop.
Save lmEshoo/61f36e922b26d7cfaacd0194e733cfed to your computer and use it in GitHub Desktop.
import pandas as pd
#change the name of ex1 to the master | ex2 to slave
df1 = pd.ExcelFile("ex1.xls").parse("Sheet1").set_index("number")
df2 = pd.ExcelFile("ex2.xls").parse("Sheet1").set_index("number")
a1, a2 = df1.align(df2)
different = (a1 != a2).any(axis=1)
comp = a1[different].join(a2[different], lsuffix='_master', rsuffix='_slave')
comp.to_excel("comp.xls")
print comp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment