I have an excel spreadsheet that has dates in the first column, the rest is the numeric values observed for each attribute. I imported the whole data set using read/readlines function.
How do I separate the imported data into datearray (first column in the imported dataset) and a separate matrix of numeric values ( data that I want to work on)?
For example:
I am importing the following data:
ObservationDate Attribute1 Attribute2 Attribute3
01/01/2012 105 101 100
02/01/2012 101 101 95
03/01/2012 98 95 97
I would like to create the following from this data:
DateArrayList = [01/01/2012, 02/01/2012, 03/01/2012]
105 101 100ValuesMatrix =
101 101 9598 95 97
These list comprehensions should do what you’re looking for (assume that the data is in testdata.xls, and that it is tab-delimited):
This prints