Thanks for your assistance, I was following this example: http://www.scipy.org/Numpy_Example_List#head-779283aaa3cc20a3786ad33c2ee1fee9d68a4a53
I intend to use different arrays once I have resolved this problem. Trying your suggestion: ... print (rf1) print (np.corrcoef(rf1, rf1, rowvar=0)) results in: [[-0.00641625] [-0.00498411] [-0.0038015 ]] [[ 1. 1.] [ 1. 1.]] which should have been a 3x3 matrix as for "stacking rf1 rf1 into a single array first" how would I do this? Regards, Rui ________________________________ From: "[email protected]" <[email protected]> To: Discussion of Numerical Python <[email protected]> Sent: Wed, September 8, 2010 1:09:46 PM Subject: Re: [Numpy-discussion] ValueError: objects are not aligned On Wed, Sep 8, 2010 at 5:42 AM, RuiDC <[email protected]> wrote: > > 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])) numpy.corrcoef(x, y=None, rowvar=1, bias=0) try np.corrcoef(rf1, rf1, rowvar=0) no [ ] or stacking rf1 rf1 into a single array first Josef > > 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. > > _______________________________________________ > NumPy-Discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion > _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
