[Numpy-discussion] How to import input data to make ndarray for batch processing?

Christopher Barker Chris.Barker at noaa.gov
Thu Nov 18 13:43:44 EST 2010


On 11/18/10 7:40 AM, Dave Hirschfeld wrote:
> In [7]: data = np.loadtxt('dummy_data.txt')

or, faster:

data = np.fromfile('dummy_data.txt', dtype=np.float64, sep = ' ')

fromfile() is not very flexible, and doesn't have good error handling, 
but it's a lot faster than loadtxt for the simple cases like this.


-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 at noaa.gov



More information about the NumPy-Discussion mailing list