PDA

View Full Version : csv reading


kgarr
02-24-2006, 06:32 PM
I am using this command to import a csv file

temp = [[float(val) for val in row] for row in csv.reader(file('data.csv','rUb')) ]


this reads in my data as an array of the rows in my data. How do I change it so that my data is in an array of columns of my data? Mainly, I want to be able to easily find the max and min values of each column in my data after loaded into Vizard.

farshizzo
02-27-2006, 12:02 PM
Hi,

Try the following code to transpose the list:def transpose(m):
return [[m[y][x] for y in range(len(m))]for x in range(len(m[0]))]

temp = transpose(temp)