-1

It might be too simple question though,,

I want to make

from

a = np.array([1,2,3])
b = np.array([4,5,6])

to

[[1,2,3],
[4,5,6]]

+ ,concatenate, append neither doesn't work.

whitebear
  • 8,922
  • 18
  • 81
  • 171

1 Answers1

3

How about vstack:

np.vstack([a,b])

Or stack:

np.stack([a,b], axis=0)

Output:

array([[1, 2, 3],
       [4, 5, 6]])
Quang Hoang
  • 131,600
  • 10
  • 43
  • 63