1import seaborn as sns
2df = sns.load_dataset('iris')
3corr_matrix = df.corr()
4corr_matrix.style.background_gradient(cmap='coolwarm')
5# 'RdBu_r', 'BrBG_r', & PuOr_r are other good diverging colormaps
6
1>>> r = np.corrcoef(x, y)
2>>> r
3array([[1. , 0.75864029],
4 [0.75864029, 1. ]])
5>>> r[0, 1]
60.7586402890911867
7>>> r[1, 0]
80.7586402890911869
9