python - Concatenate each line of two arrays into a single one -


let's have 2 arrays , b.

a.shape (95, 300) b.shape (95, 3) 

how can obtain new array c concatenating each of 95 lines ?

c.shape (95, 303) 

iiuc, use hstack:

>>> = np.ones((95, 300)) >>> b = np.ones((95, 3)) * 2 >>> a.shape (95, 300) >>> b.shape (95, 3) >>> c = np.hstack((a,b)) >>> c array([[ 1.,  1.,  1., ...,  2.,  2.,  2.],        [ 1.,  1.,  1., ...,  2.,  2.,  2.],        [ 1.,  1.,  1., ...,  2.,  2.,  2.],        ...,         [ 1.,  1.,  1., ...,  2.,  2.,  2.],        [ 1.,  1.,  1., ...,  2.,  2.,  2.],        [ 1.,  1.,  1., ...,  2.,  2.,  2.]]) >>> c.shape (95, 303) 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -