Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Reading .csv files

  • To: mathgroup at
  • Subject: [mg32997] Re: [mg32971] Reading .csv files
  • From: Tomas Garza <tgarza01 at>
  • Date: Sat, 23 Feb 2002 02:38:19 -0500 (EST)
  • References: <>
  • Sender: owner-wri-mathgroup at

I set up an artificial example in Excel, and saved it as .txt. The values
are as follows (3 columns of values, where the first entry is the header):

Weight Size Height
3            22 122
6            46 345
8            31 768
2            59 322
9            54 879
8            21 455
3           40 657
5           44 369
7           56 221

Then I read them in with

vals = Transpose[ReadList["test.txt", Word,
    RecordLists -> True]]

and then I convert numbers into expressions (i.e., actual numbers), leaving
the header as text for each variable:

({#[[1]], ToExpression[Rest[#]]} & ) /@ vals

I wonder if this is what you had in mind.

Tomas Garza
Mexico City
----- Original Message -----
From: "Coleman, Mark" <mark.coleman at>
To: mathgroup at
Subject: [mg32997] [mg32971] Reading .csv files

> Greetings,
> I often Import .csv data from spreadsheets. I normally just delete any
column or row headers,Import the data, then organize it into lists.
> Now say I have time series data oriented 'down' a column, i.e., each
column corresponds to all the obersvations for single variable, and the
first entry of each column is the variable name. How would I create a
Mathematica list for each varaible, where the list name (in Mathematica) is
the variable name from each column, and the list contents are the remaining
elements of the spreadsheet column?
> Thanks
> -Mark

  • Prev by Date: Re: Mean
  • Next by Date: RE: Using Symbols with Plot
  • Previous by thread: Reading .csv files
  • Next by thread: Re: Reading .csv files