Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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
Comment

correlation matrix python

# option 1
corr_matrix = df.corr()
corr_matrix.style.background_gradient(cmap='coolwarm')

# option 2
plt.figure(figsize=(10,10))
cor = df.corr()
sns.heatmap(cor, annot=True, cmap=plt.cm.Blues)
Comment

correlation python

import numpy as np
import scipy.stats
x = np.arange(15, 20)
y = np.arange(5, 10)
stat, p = scipy.stats.pearsonr(x, y) 
Comment

correlation matrix in python

df.corr()
Comment

PREVIOUS NEXT
Code Example
Python :: seaborn pairplot label rotation 
Python :: mongodb between two values 
Python :: python clone object 
Python :: pandas fill na with value from another column 
Python :: python read csv 
Python :: python iterate dictionary key value 
Python :: install flake8 python 
Python :: get role from name discord.py 
Python :: between date pandas 
Python :: python color text on windows 
Python :: django admin prefetch_related 
Python :: matrix pow python 
Python :: python get arguments 
Python :: df from numpy array 
Python :: update anaconda 
Python :: django form password field 
Python :: how to remove coma in python 
Python :: save pandas dataframe to parquet 
Python :: how to check if an input is a number in python 
Python :: tkinter navigate pages 
Python :: How to update python using anaconda/conda 
Python :: mysql config not found 
Python :: how to convert month to number in python 
Python :: remove all occurrences of a character in a list python 
Python :: counter in sort python 
Python :: pandas to_csv append 
Python :: python r squared 
Python :: import excel file to python 
Python :: flask development mode 
Python :: how to change voice of pyttsx3 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =