标签: python numpy matrix covariance
对于以下示例代码,我得到一个2x2协方差矩阵。我怎么能得到3x3协方差矩阵?
a = [3,9,8,2] b = [4,7,2,5] c = [3,4,6,7] cov_abc = np.cov(a,b,c) print cov_abc
答案 0 :(得分:8)
尝试
x = np.vstack([a,b,c]) cov = np.cov(x)