WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 02-24-2006, 06:32 PM
kgarr kgarr is offline
Join Date: Jan 2006
Location: Glassboro, NJ
Posts: 22
csv reading

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.
Reply With Quote
Old 02-27-2006, 12:02 PM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849

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)
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 11:03 AM.

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