Newbie - converting csv files to arrays in NumPy - Matlab vs. Numpy comparison

Robert Kern robert.kern at gmail.com
Fri Jan 12 07:28:43 CET 2007


Travis E. Oliphant wrote:

> If you use numpy.fromfile, you need to skip past the initial header row 
> yourself.  Something like this:
> 
> fid = open('somename.csv')

# I think you also meant to include this line:
header = fid.readline()

> data = numpy.fromfile(fid, sep=',').reshape(-1,6)
> # for 6-column data.

-- 
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 Python-list mailing list