6 Sep
2007
6 Sep
'07
8:13 p.m.
John Hunter schrieb:
Is it desirable that numpy.corrcoef for two arrays returns a 2x2 array rather than a scalar
In [10]: npy.corrcoef(npy.random.rand(10), npy.random.rand(10)) Out[10]: array([[ 1. , -0.16088728], [-0.16088728, 1. ]])
I always end up extracting the 0,1 element anyway. What is the advantage, aside from backwards compatibility, for returning a 2x2? JDH
Forgive me if my answer is trivial and misses your point, but I guess because for more than two data series one also gets the entire correlation matrix and that is desirable. However, I would agree that the name "corrcoef" is unfortunate, suggesting a scalar value (at least to me). -sven