Concatenating column vectors using numpy arrays Concatenating column vectors using numpy arrays numpy numpy

Concatenating column vectors using numpy arrays


I believe numpy.column_stack should do what you want.Example:

>>> a = np.array((0, 1))>>> b = np.array((2, 1))>>> c = np.array((-1, -1))>>> numpy.column_stack((a,b,c))array([[ 0,  2, -1],       [ 1,  1, -1]])

It is essentially equal to

>>> numpy.vstack((a,b,c)).T

though. As it says in the documentation.


I tried the following. Hope this is good enough for what you are doing ?

>>> np.vstack((a,b,c))array([[ 0,  1],       [ 2,  1],       [-1, -1]])>>> np.vstack((a,b,c)).Tarray([[ 0,  2, -1],       [ 1,  1, -1]])