>>> a = np.array([[1, 2], [3, 4]]) >>> b = np.array([[5, 6]]) >>> np.concatenate((a, b), axis=0) array([[1, 2], [3, 4], [5, 6]]) >>> np.concatenate((a, b.T), axis=1) array([[1, 2, 5], [3, 4, 6]])
数组拼接,axis为0则在行向量上拼接 ,为1则在列向量上面拼接。
numpy.ones_like(row)是将row都置为1的意思