python 计算 Pearson 线性相关系数

1. 代码

import scipy
from scipy.stats import pearsonr

x = scipy.array([1, 2, 3, 4, 5])
y = scipy.array([2, 4, 6, 8, 9])

r_row, p_value = pearsonr(x, y)
print r_row
print p_value

效果
这里写图片描述

猜你喜欢

转载自blog.csdn.net/Canhui_WANG/article/details/81143174
今日推荐