Computing correlations with SciPy

Felipe Almeida Lessa felipe.lessa at gmail.com
Thu Mar 16 16:52:47 CET 2006


Em Qui, 2006-03-16 às 07:49 -0800, tkpmep at hotmail.com escreveu:
> I want to compute the correlation between two sequences X and Y, and
> tried using SciPy to do so without success.l Here's what I have, how
> can I correct it?

$ python2.4
Python 2.4.2 (#2, Nov 20 2005, 17:04:48)
[GCC 4.0.3 20051111 (prerelease) (Debian 4.0.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = [1,2,3,4,5]
>>> y = [5,4,3,2,1]
>>> import scipy
>>> scipy.corrcoef(x, y)
array([[ 1., -1.],
       [-1.,  1.]])
>>> # Looks fine for me...





More information about the Python-list mailing list