-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
  • 11,200
  • 24
  • 114
  • 237

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
  • 146,074
  • 10
  • 56
  • 74