Sidwyn Koh
Sidwyn Koh

Reputation: 1742

Joining two 2D-arrays in numpy

I have a (1000, 784) 2D array and a (8000, 784) 2D array, and been trying to concatentate them to get a (9000, 784) 2D array.

I've tried:

np.concatenate((A, B))
np.vstack((A, B))
np.hstack((A, B))

but none of them work. Would anyone be able to help me out?

Upvotes: 0

Views: 62

Answers (1)

Alex Martelli
Alex Martelli

Reputation: 881555

I don't understand where your problem comes from...:

>>> a = np.zeros((1000,784))
>>> b = np.zeros((8000,784))
>>> c = np.concatenate((a,b))
>>> c.shape
(9000, 784)
>>> 

Upvotes: 1

Related Questions