#-*- 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明日花キララ:明日花绮罗年度... 22811
- 2明日花キララ(明日花绮罗)经... 13380
- 3家庭养花知识大全 家庭养花有... 8767
- 4兰花叶子扭的是什么兰 8659
- 5家庭养花风水知识 家庭养花“... 8484
- 6君子兰什么品种最名贵 十大名... 7881
- 7十大致癌花卉排行榜,哪些花卉... 7579
- 8五月天婷婷开心六月丁香:音乐... 7344
- 9秋天养花,掌握这5点养花知识... 7074
- 10李晓明工笔牡丹(魏紫)《牡丹... 6753
分享热点排名




