Skip to content

Instantly share code, notes, and snippets.

@BexTuychiev
Created March 9, 2021 08:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BexTuychiev/f2381691954579a284b65bbfe1448873 to your computer and use it in GitHub Desktop.
Save BexTuychiev/f2381691954579a284b65bbfe1448873 to your computer and use it in GitHub Desktop.
houses = pd.read_csv('data/melb_data.csv')
# Calculate pairwise-correlation
matrix = houses.corr()
# Create a mask
mask = np.triu(np.ones_like(matrix, dtype=bool))
# Create a custom diverging palette
cmap = sns.diverging_palette(250, 15, s=75, l=40,
 n=9, center="light", as_cmap=True)
plt.figure(figsize=(16, 12))
sns.heatmap(matrix, mask=mask, center=0, annot=True,
 fmt='.2f', square=True, cmap=cmap)
plt.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment