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 :: python requests post 
Python :: define empty numpy array 
Python :: read tsv with python 
Python :: python append n numbers to list 
Python :: python push to dataframe pandas 
Python :: if found then stop the loop python 
Python :: sqlalchemy create engine Microsoft SQL 
Python :: list sort by key python 
Python :: write a list into csv python 
Python :: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable 
Python :: how to read excel file in python 
Python :: Replace the string with NAN value 
Python :: how to sum certain columns row wise in python 
Python :: json to base64 python 
Python :: python scatter plot legend 
Python :: numpy sort array by another array 
Python :: pandas read dictionary 
Python :: extract pdf with python 
Python :: remove add button django admin 
Python :: if list of columns exist pandas 
Python :: seaborn countplot 
Python :: read excel into dataframe python 
Python :: count decimal number python 
Python :: dataframe to list pyspark 
Python :: remove unnamed 0 column pandas 
Python :: count unique pandas 
Python :: python left rotation 
Python :: python checking if something is equal to NaN 
Python :: make screen shot of specific part of screen python 
Python :: python range in reverse order 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =