shape[0]理解为第一维,shape[1]理解为第二维,同理还有shape[2]、shape[3]等等 。
举个栗子就是:a=array( [ [ [1,2,3] , [4,5,6] ] ] ),这是个三维数组,a.shape[0]=1, a.shape[1]=2, a.shape[2]=3
from numpy import *
a=array( [ [ [1,2,3] , [4,5,6] ] ] )
a.shape[0]
1
a.shape[1]
2
a.shape[2]
3
shape[0]理解为第一维,shape[1]理解为第二维,同理还有shape[2]、shape[3]等等 。
举个栗子就是:a=array( [ [ [1,2,3] , [4,5,6] ] ] ),这是个三维数组,a.shape[0]=1, a.shape[1]=2, a.shape[2]=3
from numpy import *
a=array( [ [ [1,2,3] , [4,5,6] ] ] )
a.shape[0]
1
a.shape[1]
2
a.shape[2]
3