[Numpy-discussion] Speeding up loadtxt / savetxt

Chris Barker Chris.Barker@noaa....
Sun Apr 25 11:20:38 CDT 2010


Andreas wrote:
> I was wondering if there's a way to speedup loadtxt/savetxt for big 
> arrays? So far, I'm plainly using something like this::
> 
>     file = open("array.txt","w")
>     a = np.loadtxt(file)
>     file.close()

> However, since my files are pretty big (~200M), that's taking a long 
> time... Perhaps there's a way to speed things up?

for the simplest of cases, you can use fromfile() with a delimiter -- if 
it works, it's much faster.

See the archives of this list and the tickets for discussion of 
limitations and improvements it could use.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list