Numpy: Concatenating multidimensional and unidimensional arrays
unutbu's answer works in general, but in this case there is also np.column_stack
>>> xarray([[1, 2], [4, 5]])>>> yarray([3, 6])>>> np.column_stack((x,y))array([[1, 2, 3], [4, 5, 6]])
Also works:
In [22]: np.append(x, y[:, np.newaxis], axis=1)Out[22]: array([[1, 2, 3], [4, 5, 6]])