Skip to content

Instantly share code, notes, and snippets.

@al102964
Created June 19, 2020 08:50
Show Gist options
  • Save al102964/7ecdfb633f269abdc7e6a852c536c027 to your computer and use it in GitHub Desktop.
Save al102964/7ecdfb633f269abdc7e6a852c536c027 to your computer and use it in GitHub Desktop.
import ppscore as pps
import matplotlib.pyplot as plt
df1_styler = df.corr().abs().style.set_table_attributes("style='display:inline'").set_caption('Correlation Table')
df2_styler = pps.matrix(df).style.set_table_attributes("style='display:inline'").set_caption('PPS Table')
fig, ax =plt.subplots(nrows=2, ncols=2,figsize=(16,8))
display_html(df1_styler._repr_html_()+df2_styler._repr_html_(), raw=True)
sns.heatmap(df.corr().abs(),annot=True, ax = ax[0,0]).set_title("corr")
sns.heatmap(pps.matrix(df),annot=True, ax=ax[0,1]).set_title("pps")
sns.distplot(df.corr().abs().unstack().sort_values(ascending=False).drop_duplicates(), bins=10, ax=ax[1,0]).set(xlim=(0, 1))
sns.distplot(pps.matrix(df).abs().unstack().sort_values(ascending=False).drop_duplicates(), bins=10, ax=ax[1,1]).set(xlim=(0,1))
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment