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
效果
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
效果