[Numpy-discussion] loading database data into numpy arrays

John Salvatier jsalvati@u.washington....
Thu Aug 19 12:00:00 CDT 2010


I am trying to load some time series data into numpy arrays from a MySQL
database using pyodbc, but I am not sure what the standard way to do this
is. I found the following:
http://www.aidanfindlater.com/python-db-api-to-numpy but when I tried after
doing a select (I made sure the cursor had rows).

np.fromiter(cursor, dtype=[('a',float), ('b', float)])

I got

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Users\jsalvatier\workspace\rpxdata\src\rpxdata\mysql.py", line
45, in run_statistics_15
    return np.fromiter(cursor, dtype=[('a',float), ('b', float)])
TypeError: expected a readable buffer object

Does anyone have advice on this?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100819/7cc8375e/attachment.html 

More information about the NumPy-Discussion mailing list