Reputation: 3869
I am trying to add array y
to array x
by this code:
import numpy as np
x = np.zeros((5,2))
y = np.array([[1,2]])
np.append(x , y)
But the result of x
is yet:
array([[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.]])
What is the problem?
Upvotes: 1
Views: 429
Reputation: 200
Use np.concatenate
:
import numpy as np
x = np.zeros((5,2))
y = np.array([[1,2]])
result = np.concatenate((x,y), axis = 0)
Upvotes: 1