[SciPy-user] storing numpy arrays

Robert Kern robert.kern@gmail....
Thu Mar 12 17:57:20 CDT 2009

On Thu, Mar 12, 2009 at 17:50, Michael Hearne <mhearne@usgs.gov> wrote:
> Conor - Thank you for your suggestion.  I am in fact already using
> pytables in another part of my application.  However, using PyTables for
> this portion is not a desirable option.
> Perhaps I should rephrase the question:
> What is the the most efficient way to serialize a numpy array into a
> structure that _could_ be written to a disk, or stuffed into a database,
> etc?

Use numpy.lib.format.{read,write}_array() to use the NPY format, which
should be the most robust and efficient way to do what you want. I
have used this to store numpy arrays as MySQL BLOBs before, and it
worked quite well.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco

More information about the SciPy-user mailing list