NumPy筆記:ndarray的屬性(dtype,shape,ndim,size,itemsize)


"""
    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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM