1>>> import numpy as np
2>>> a = ([1,2,3,4,5])
3>>> b = ([2,3,4,5,6])
4>>> c = ([3,4,5,6,7])
5
6>>> np.array([a, b, c])
7array([[1, 2, 3, 4, 5],
8 [2, 3, 4, 5, 6],
9 [3, 4, 5, 6, 7]])
10
11>>> np.stack([a, b, c], axis=0)
12array([[1, 2, 3, 4, 5],
13 [2, 3, 4, 5, 6],
14 [3, 4, 5, 6, 7]])
15
16>>> np.stack([a, b, c], axis=1) # not what you want, this is only to show what is possible
17array([[1, 2, 3],
18 [2, 3, 4],
19 [3, 4, 5],
20 [4, 5, 6],
21 [5, 6, 7]])
1>>> a = np.array([1, 2, 3])
2>>> b = np.array([2, 3, 4])
3>>> np.vstack((a,b))
4array([[1, 2, 3],
5 [2, 3, 4]])
6
7>>> a = np.array([[1], [2], [3]])
8>>> b = np.array([[2], [3], [4]])
9>>> np.vstack((a,b))
10array([[1],
11 [2],
12 [3],
13 [2],
14 [3],
15 [4]])
1>>> a = np.array([1, 2, 3])
2>>> b = np.array([2, 3, 4])
3>>> np.vstack((a,b))
4array([[1, 2, 3],
5 [2, 3, 4]])
6
1import numpy as np
2a = np.array([1, 2, 3])
3b = np.array([2, 3, 4])
4np.vstack((a,b))
1>>> a = np.array([[1], [2], [3]])
2>>> b = np.array([[2], [3], [4]])
3>>> np.vstack((a,b))
4array([[1],
5 [2],
6 [3],
7 [2],
8 [3],
9 [4]])
10
1>>> a = np.array([[1], [2], [3]])
2>>> b = np.array([[4], [5], [6]])
3>>> np.vstack((a,b))
4array([[1],
5 [2],
6 [3],
7 [4],
8 [5],
9 [6]])
10