Newbie query - reading text file (with column headings) into dictionary

Terry Reedy tjreedy at udel.edu
Sun Dec 8 18:22:40 EST 2002


"Mike Meyer" <mwm at mired.org> wrote in message
> Personally, I don't think this belongs in a cookbook, because it
> slices the data in an unusual direction. If you sliced it the other
> way - making each line an object, instead of each column - then
> accessing individual data elements is nearly identical: you just
swap
> the order of the subscripts. However, you're more likely to want to
> deal with a line as an individual object than a column.

Fortran (at least in the past) slices arrays in this 'unusal
direction'.  There have been (and probably still are) statistical/data
analysis programs (especially Fortran-based) that do the same,
especially when the number of rows and therefore the lengths of
columns are fixed.  The data within each column are homogeneous (same
type), though this is less important for Python.  It facilitates
adding new columns (new = log(old), for instance) or calculating the
correlation between pairs of columns.

Terry J. Reedy





More information about the Python-list mailing list