a = np.array(['1', '2'])
b = np.array(['a', 'b'])
I want to combine a and b as follows
array([['1', 'a'],
['2', 'b']])
I couldn't do it with hstack or vstack, so I did it as follows.
>>>np.dstack((a, b))
array([[['1', 'a'],
['2', 'b']]])
>>>np.dstack((a, b)).shape
(1, 2, 2)
>>>c.reshape(c.shape[1], c.shape[2])
array([['1', 'a'],
['2', 'b']], dtype='<U1')
Recommended Posts