WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   csv reading (https://forum.worldviz.com/showthread.php?t=517)

kgarr 02-24-2006 06:32 PM

csv reading
 
I am using this command to import a csv file

Code:

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:
Code:

def transpose(m):
        return [[m[y][x] for y in range(len(m))]for x in range(len(m[0]))]

temp = transpose(temp)



All times are GMT -7. The time now is 10:20 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC