Last active
May 10, 2016 14:00
-
-
Save JonasHeylen/feea61c798fdb955f16b5ba785974e1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def diff(df1, df2, key): | |
def highlight_diff(col): | |
return ['background-color: yellow' if len(col.unique()) > 1 else '' for v in col] | |
s1 = df1.loc[key] | |
s2 = df2.loc[key] | |
return pd.DataFrame([s1, s2], index=['1', '2']).transpose().style.apply(highlight_diff, axis=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment