皮尔森相关性系数的计算python代码(热力图版)
Posted 时光-ing
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了皮尔森相关性系数的计算python代码(热力图版)相关的知识,希望对你有一定的参考价值。
部分代码:
import numpy
import pandas as pd
import numpy as np
from matplotlib.font_manager import FontProperties
font_set = FontProperties(fname=r"c:\\windows\\fonts\\simsun.ttc", size=15)
df = pd.read_csv('XXX.csv', encoding='gbk')
corr=np.corrcoef(df.values,rowvar=0)
import seaborn as sns
import matplotlib.pyplot as plt
values=corr
plt.figure(figsize=(18,22))
x_ticks = ["a","b","c","d","e","f","g","h","i","j","k","l","m","m"]
y_ticks = ["a","b","c","d","e","f","g","h","i","j","k","l","m","m"] # 自定义横纵轴
......
结果图:
完整代码链接:皮尔森相关性系数的计算python代码(四)
相关链接
1、皮尔森相关性系数的计算python代码(一)
2、皮尔森相关性系数的计算python代码(二)
3、皮尔森相关性系数的计算python代码(三)
4、皮尔森相关性系数的计算python代码(四)(热力图版)
5、斯皮尔曼相关系数计算的python代码
以上是关于皮尔森相关性系数的计算python代码(热力图版)的主要内容,如果未能解决你的问题,请参考以下文章