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.

Leave a Comment