[Numpy-discussion] ValueError: objects are not aligned
RuiDC
ruidc at yahoo.com
Wed Sep 8 05:42:51 EDT 2010
I'm getting this error, which must be a simple error in getting the result
from the cursor in the right shape, how do I get the cursor into the array
as a single dimension?:
import numpy as np
import sqlite3
conn = sqlite3.connect("simpledb")
cursor1 = conn.execute("select LogReturn from tblReturns limit 3")
rf1 = np.asarray(cursor1.fetchall(), dtype=np.float64)
print (rf1)
print (np.corrcoef([rf1, rf1]))
result:
[[-0.00641625]
[-0.00498411]
[-0.0038015 ]]
Traceback (most recent call last):
File "C:\Documents and Settings\rui\workspace\numpytest\src\numpytest.py",
line 38, in <module>
print (np.corrcoef([rf1, rf1]))
File "C:\Python26\lib\site-packages\numpy\lib\function_base.py", line
2003, in corrcoef
c = cov(x, y, rowvar, bias, ddof)
File "C:\Python26\lib\site-packages\numpy\lib\function_base.py", line
1953, in cov
return (dot(X, X.T.conj()) / fact).squeeze()
--
View this message in context: http://old.nabble.com/ValueError%3A-objects-are-not-aligned-tp29641661p29641661.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
More information about the NumPy-Discussion
mailing list