pacodelumberg
pacodelumberg

Reputation: 2274

Calculating Covariance Matrix of Two Distributions In Python

I would like to calculate the Covariance matrix of two distributions, what could be the possible ways to calculate them in python?

Upvotes: 2

Views: 1081

Answers (1)

David Robinson
David Robinson

Reputation: 78600

You should use numpy.

>>> from numpy import cov
>>> cov([1, 2, 3], [2, 12, 14])
array([[  1.        ,   6.        ],
       [  6.        ,  41.33333333]])

Upvotes: 6

Related Questions