Learn | NEPs | User Guide | API reference | Building from source | Development | Release notes | NumPy’s module structure | Array objects | The N-dimensional array (ndarray) | Scalars | Data type objects (dtype) | Data type promotion in NumPy | Iterating over arrays | Standard array subclasses | Masked arrays | The array interface protocol | Datetimes and timedeltas | Universal functions (ufunc) | Routines and objects by topic | Typing (numpy.typing) | NumPy C-API | Array API standard compatibility | CPU/SIMD optimizations | Thread Safety | Global Configuration Options | NumPy security | Testing guidelines
attribute
ndarray.itemsize
Length of one array element in bytes.
Examples
>>> importnumpyasnp>>> x=np.array([1,2,3],dtype=np.float64)>>> x.itemsize8>>> x=np.array([1,2,3],dtype=np.complex128)>>> x.itemsize16