求numpy.array数组里有多少个元素(len,shape,size)
import numpy as npz = np.random.randint(10,size=(3,5))print("z = \n", z)print("len(z) = ",len(z))print("z.size = ", z.size)print("z.shape = ", z.shape)运行结果:z =[[8 5 6 7 7][8 2 7 5 1][9 3 0 3 3]]len(z)
·
import numpy as np
z = np.random.randint(10,size=(3,5))
print("z = \n", z)
print("len(z) = ",len(z))
print("z.size = ", z.size)
print("z.shape = ", z.shape)
运行结果:
z =
[[8 5 6 7 7]
[8 2 7 5 1]
[9 3 0 3 3]]
len(z) = 3
z.size = 15
z.shape = (3, 5)
更多推荐
所有评论(0)