Advertisement
elena1234

heatmap with Seaborn in Python

May 1st, 2022 (edited)
903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.95 KB | None | 0 0
  1. import numpy as np
  2. import pandas as pd
  3. import seaborn as sns
  4. import matplotlib.pyplot as plt
  5.  
  6. df = pd.read_csv('C:/Users/eli/Desktop/application_record.csv')
  7.  
  8. # Recreate the Heatmap shown below
  9. df = df.drop('FLAG_MOBIL', axis = 1)
  10. sns.heatmap(df.corr(), annot = False, fmt='.1g',cmap= 'coolwarm')
  11.  
  12. fig, ax = plt.subplots(figsize=(10,8))  
  13. np.round(df.corr(), 2)
  14. sns.heatmap(np.round(df.corr(), 2), annot = True, linewidths=.5, ax=ax)
  15. plt.show()
  16.  
  17. plt.figure(figsize=(12,8))
  18. sns.heatmap(df.corr(),cmap='viridis', annot=True)
  19.  
  20. ''' How are the worst movies rated across all platforms?
  21. Create a clustermap visualiaztion of all normalized scores. Note the differences in ratings,
  22. highly rated movies should be clustered together versus poorly rated movies. Note: this clustermap
  23. does need to have the Film titles as the index, feel free to drop it for the clustermap.'''
  24. g = sns.clustermap(df_norm_scores, cmap="mako", vmin=1, vmax=5, col_cluster = False)
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement