numpy.dtype.itemsize#
屬性
- dtype.itemsize#
此資料型別物件的元素大小。
對於 21 種型別中的 18 種,此數字由資料型別固定。對於彈性資料型別,此數字可以是任何值。
範例
>>> import numpy as np >>> arr = np.array([[1, 2], [3, 4]]) >>> arr.dtype dtype('int64') >>> arr.itemsize 8
>>> dt = np.dtype([('name', np.str_, 16), ('grades', np.float64, (2,))]) >>> dt.itemsize 80