Computing correlations with SciPy

tkpmep at hotmail.com tkpmep at hotmail.com
Thu Mar 16 16:49:31 CET 2006


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?

>>> X = [1, 2, 3, 4, 5]
>>> Y = [5, 4, 3, 2, 1]
>>> import scipy
>>> scipy.corrcoef(X,Y)
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python24\Lib\site-packages\numpy\lib\function_base.py", line
671, in corrcoef
    d = diag(c)
  File "C:\Python24\Lib\site-packages\numpy\lib\twodim_base.py", line
80, in diag
    raise ValueError, "Input must be 1- or 2-d."
ValueError: Input must be 1- or 2-d.
>>> 

Thanks in advance

Thomas Philips




More information about the Python-list mailing list