numpy 数组维度,形状,大小

import numpy as np

array = np.array([
    [1, 2, 3],
    [4, 5, 6]

])

print(array)

print('number of dim:',array.ndim)
print('shape:', array.shape)
print('size:', array.size)

结果
[[1 2 3]
[4 5 6]]
number of dim: 2
shape: (2, 3)
size: 6

猜你喜欢

转载自blog.csdn.net/code_fighter/article/details/80371535