[SciPy-user] storing numpy arrays

Michael Hearne mhearne at usgs.gov
Thu Mar 12 17:35:42 EDT 2009


I have a MySQL database, in which I would like to store a numpy array as 
a BLOB.  I'm trying to find out the easiest/most efficient way to 
store/extract this data.

I looked at scipy.io.write_array, which looked somewhat promising, until 
I saw the notice that this method is deprecated in favor of numpy.savetxt.

I could potentially use scipy.io.savemat/loadmat, but that would require 
writing to a binary (.mat file), then reading it back in again just to 
stuff it into the database.

I could also use pickle, but I found a bug report somewhere that pickle 
may do strange things to the array in the process or reading or writing.

Does anyone have any suggestions?

Thanks,

Mike




More information about the SciPy-User mailing list