numpy.column_stack¶

numpy.
column_stack
(tup)[源代码]¶ Stack 1D arrays as columns into a 2D array.
Take a sequence of 1D arrays and stack them as columns to make a single 2D array. 2D arrays are stacked asis, just like with
hstack
. 1D arrays are turned into 2D columns first.Parameters:  tup : sequence of 1D or 2D arrays.
Arrays to stack. All of them must have the same first dimension.
Returns:  stacked : 2D array
The array formed by stacking the given arrays.
参见
Examples
>>> a = np.array((1,2,3)) >>> b = np.array((2,3,4)) >>> np.column_stack((a,b)) array([[1, 2], [2, 3], [3, 4]])