Answers for "python correlation matrix code"

3

correlation matrix python

import seaborn as sns
df = sns.load_dataset('iris')
corr_matrix = df.corr()
corr_matrix.style.background_gradient(cmap='coolwarm')
# 'RdBu_r', 'BrBG_r', & PuOr_r are other good diverging colormaps
Posted by: Guest on August-31-2021
0

correlation coefficient python numpy example

>>> r = np.corrcoef(x, y)
>>> r
array([[1.        , 0.75864029],
       [0.75864029, 1.        ]])
>>> r[0, 1]
0.7586402890911867
>>> r[1, 0]
0.7586402890911869
Posted by: Guest on March-18-2021

Code answers related to "python correlation matrix code"

Python Answers by Framework

Browse Popular Code Answers by Language