I need to concatenate two numpy arrays side by side
np1=np.array([1,2,3])
np2=np.array([4,5,6])
I need np3 as [1,2,3,4,5,6] with the same shape, how to achieve this?
I need to concatenate two numpy arrays side by side
np1=np.array([1,2,3])
np2=np.array([4,5,6])
I need np3 as [1,2,3,4,5,6] with the same shape, how to achieve this?
In concatenate you have to pass axis as None
In [9]: np1=np.array([1,2,3])
   ...: np2=np.array([4,5,6])
In [10]: np.concatenate((np1,np2), axis=None)
Out[10]: array([1, 2, 3, 4, 5, 6])
 
    
    Use np.hstack made for this:
np3 = np.hstack((np1,np2))
output:
[1 2 3 4 5 6]
