Let's say I have two arrays a and b.
a.shape is (95, 300)
b.shape is (95, 3)
How can I obtain a new array c by concatenating each of the 95 lines ?
c.shape is (95, 303)
Let's say I have two arrays a and b.
a.shape is (95, 300)
b.shape is (95, 3)
How can I obtain a new array c by concatenating each of the 95 lines ?
c.shape is (95, 303)
IIUC, you could use hstack
:
>>> a = 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)