vstack

numpy.vstack(tup)

将数组堆叠成一列。方法 等同于 np.concatenate(tup, axis=0)

参数 :tup -- sequence of ndarrays Tuple containing arrays to be stacked. The arrays must have the same shape along all but the first axis.


返回 :stacked -- ndarray The array formed by stacking the given arrays.



a = np.array([1, 2, 3])
b = np.array([2, 3, 4])
np.vstack((a,b))
>>>array([[1, 2, 3],[2, 3, 4]])

a = np.array([[1], [2], [3]])
b = np.array([[2], [3], [4]])
np.vstack((a,b))
>>> array([[1],
       [2],
       [3],
       [2],
       [3],
       [4]])

你可能感兴趣的:(Python)