reading tabular data

Chris Barker chrishbarker at home.net
Wed Nov 28 16:03:53 EST 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
(http://www.python.org/topics/scicomp/storage.html) and FortranFormat.

> I can imagine the.re 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.

-Chris





-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list