A
Arvid Andersson
Good afternoon,
I have some data that looks like this:
data = [[1, 2], [3, 4], [5, 6]]
I want to send columns 1 and 2 to a function
as two variables, say "plot(col1,col2)".
I can get a row by data[r], but how do I get a
column? data[:][c] would have been my guess,
but that returns the same list as data[r].
I can solve this with two additional lists and
a for loop, but that seems like an ugly hack.
Five additional lines just seems clumsy.
Is there a more elegant solution than this?
col1 = []
col2 = []
for i in range(len(data)):
col1 += [a[0]]
col2 += [a[1]]
/Arvid Andersson
I have some data that looks like this:
data = [[1, 2], [3, 4], [5, 6]]
I want to send columns 1 and 2 to a function
as two variables, say "plot(col1,col2)".
I can get a row by data[r], but how do I get a
column? data[:][c] would have been my guess,
but that returns the same list as data[r].
I can solve this with two additional lists and
a for loop, but that seems like an ugly hack.
Five additional lines just seems clumsy.
Is there a more elegant solution than this?
col1 = []
col2 = []
for i in range(len(data)):
col1 += [a[0]]
col2 += [a[1]]
/Arvid Andersson