WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-24-2006, 06:32 PM
kgarr kgarr is offline
Member
 
Join Date: Jan 2006
Location: Glassboro, NJ
Posts: 22
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.
Reply With Quote
  #2  
Old 02-27-2006, 12:02 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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)
Reply With Quote
Reply

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 01:10 PM.


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