Re: Reading .csv files
- To: mathgroup at smc.vnet.net
- Subject: [mg32984] Re: [mg32971] Reading .csv files
- From: BobHanlon at aol.com
- Date: Sat, 23 Feb 2002 02:38:01 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2/22/02 2:44:15 AM, mark.coleman at dri-wefa.com writes:
>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?
>
Clear[a,b,c];
data = {{a,b,c},{1,1,2},{2,3,4},{3,5,6},{4,7,8},{5,9,10}};
ToExpression[ToString[First[#]]<>"="<>
ToString[Rest[#]]]& /@
Transpose[data];
Bob Hanlon
Chantilly, VA USA