[Numpy-discussion] how to save a large array into a file quickly
Wed Oct 15 06:01:21 CDT 2008
On Oct 14 15:29 -1000, Eric Firing wrote:
> frank wang wrote:
> > Hi,
> > I have a large ndarray that I want to dump to a file. I know that I can
> > use a for loop to write one data at a time. Since Python is a very
> > powerfully language, I want to find a way that will dump the data fast
> > and clean. The data can be in floating point or integer.
> Use numpy.save for a single array, or numpy.savez for multiple ndarrays,
> assuming you will want to read them back with numpy. If you want to
> dump to a text file, use numpy.savetxt. If you want to dump to a binary
> file to be read by another program, you might want to use the tofile
> method of the ndarray.
I've just updated  to mention scipy.io.npfile as well as numpy.save &
friends. Now, I hope that all common ways to read/write arrays are
present in one place.
More information about the Numpy-discussion