python中的shape、shape[0]、shape[1]、与reshape
np.shape
描述的是矩阵a的形状
import numpy as np
a= np.array([[1, 2, 3, 5], [4, 5, 1, 6], [7, 4, 8, 9]])
print(a.shape)
----------------------------------------------
输出结果:
(3, 4)
shape[0]与shape[1]
描述的是矩阵的行数和列数
import numpy as np
a= np.array([[1, 2, 3, 5], [4, 5, 1, 6], [7, 4, 8, 9]])
print(a.shape[0]<