python a statement simply calculate the correlation coefficient pearson kendall spearman

 

import pandas as pd
df = pd.read_csv('demo.csv')


## 计算相关度系数 ##
df.corr() #计算pearson相关系数
df.corr('kendall')  #计算kendall相关系数
df.corr('spearman')  #计算spearman相关系数

The correlation coefficient is shown below:

Guess you like

Origin blog.csdn.net/CallMeYunzi/article/details/81134741