numpy array 分割

import numpy as np


A = np.array([1,1,1])[:,np.newaxis]

B = np.array([2,2,2])[:,np.newaxis]
#合并
C = np.vstack((A,B))
D = np.hstack((A,B))
#0,1纵横
E =np.concatenate((A,B,B,A),axis=0)
print(E)
print(C)
print(D)
print(A.shape,C.shape)
print(A.shape,D.shape)

print(A.T.shape)
#
print(A[np.newaxis,:].shape)
print(A[:,np.newaxis].shape)

 

posted @ 2018-12-09 19:56  萧白白  阅读(240)  评论(0编辑  收藏  举报