1>>> import numpy as np
2>>> A = np.array([[1,2,3,4],[5,6,7,8]])
3
4>>> A
5array([[1, 2, 3, 4],
6 [5, 6, 7, 8]])
7
8>>> A[:,2] # returns the third columm
9array([3, 7])
1data = [
2['a', 1, 2],
3['b', 3, 4],
4['c', 5, 6]
5]
6
7columns = list(zip(*data))
8
9print("column[0] = {}".format(columns[0]))
10print("column[1] = {}".format(columns[1]))
11print("column[2] = {}".format(columns[2]))
12
13# output
14>>> print("column[0] = {}".format(columns[0]))
15column[0] = ('a', 'b', 'c')
16
17>>> print("column[1] = {}".format(columns[1]))
18column[1] = (1, 3, 5)
19
20>>> print("column[2] = {}".format(columns[2]))
21column[2] = (2, 4, 6)