#-*- coding: utf-8 -*- #计算两两指标间的相关系数矩阵 import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns inputfile = 'data3.csv' #输入的数据文件 data = pd.read_csv(inputfile) #读取数据 pearson=np.round(data.corr(method = 'pearson'), 2) #计算相关系数矩阵,保留两位小数 print(pearson) pearson.to_csv("data.csv") #热力图 colormap = plt.cm.viridis plt.figure(figsize=(30,30)) plt.title('Unit_price Correlation of Features', y=1.05, size=15) sns.heatmap(data.astype(float).corr(),linewidths=0.1,vmax=1.0, square=True, cmap=colormap, linecolor='white', annot=True) plt.show()
pearson相关系数算法
来源:
时间:2024-12-01 10:56最新推荐文章于 2024-10-24 03:14:56 发布
置顶 我是花哥 于 2018-10-30 15:07:47 发布
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
相关知识
Impact of the population ratio between pest and predator on the competitive effect index among predators: taking Frankliniella intonsa and their major natural enemies as an example
Niche and interspecific association of main species in shrub layer of Cyclobalanopsis glauca community in karst hills of Guilin, southwest China
小兴安岭红松日径向变化及其对气象因子的响应
基于超市商品补货策略的分析——以2023年全国数学建模竞赛C题为例
作物种植前后土壤有机质及养分因子的空间变异分析
多花菊花色分类及色彩空间值与色素的相关性
旱作条件下保护性耕作对土壤结构和容重影响试验研究
鲜花分类算法
伏牛山栓皮栎群落优势种群种间关联动态分析
js植物算法
网址: pearson相关系数算法 https://www.huajiangbk.com/newsview795230.html
上一篇: 代码中的一个分号,引发程序员的疯 |
下一篇: 单身狗们,举起爪子,光棍节发起反 |
推荐分享

- 1君子兰什么品种最名贵 十大名 4012
- 2世界上最名贵的10种兰花图片 3364
- 3花圈挽联怎么写? 3286
- 4迷信说家里不能放假花 家里摆 1878
- 5香山红叶什么时候红 1493
- 6花的意思,花的解释,花的拼音 1210
- 7教师节送什么花最合适 1167
- 8勿忘我花图片 1103
- 9橄榄枝的象征意义 1093
- 10洛阳的市花 1039
分享热点排名