"""
    ndarray的属性(dtype,shape,ndim,size,itemsize)
"""
import numpy as np
# 创建维度3x3的ndarray数组
data = np.array([[1, 1, 1], [2, 2, 2], [3, 3, 3]])
# 打印属性
print("形状:", data.shape)
print("维数:", data.ndim)
print("数据类型:", data.dtype)
print("元素个数:", data.size)
 

 

形状: (3, 3)
维数: 2
数据类型: int32
元素个数: 9
一个数组元素的字节长度: 4

 

相关文章:

  • 2022-03-04
  • 2022-12-23
  • 2021-10-25
  • 2021-09-27
  • 2021-07-05
  • 2021-06-23
  • 2022-12-23
猜你喜欢
  • 2021-12-01
  • 2021-09-09
  • 2021-08-27
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案