reading tabular data

Chris Barker chrishbarker at
Wed Nov 28 22:03:53 CET 2001

Mark Fardal wrote:
> what do people use when they want to read in long tabular files into
> a (NumPy) array?  I have only tried Scientific.IO.readArray and
> read_ascii from Nick Bower's PYDL.  read_ascii is very simple and
> needs some work to be robust, but it was much faster than readArray
> for the example I tried. Is there something else I should know
> about?

You might also want to take a look at TableIO
( and FortranFormat.

> I can imagine are tradeoffs between speed and generality.
> (I.e., do you want to preserve types of the columns, control over
> comment characters, are strings read in as well, etc.)  Usually I would
> prefer speed over generality, as my input files are usually very simple.

Me too, which is why I have been planning for a long time to write a
clone of MATLAB's fscanf. It is very fast and simple. Maybe someday.


Christopher Barker,
ChrisHBarker at                 ---           ---           --- ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------

More information about the Python-list mailing list