SciPy

This is documentation for an old release of NumPy (version 1.17). Read this page in the documentation of the latest stable release (version 2.2).

numpy.dtype.itemsize

attribute

dtype.itemsize

The element size of this data-type object.

For 18 of the 21 types this number is fixed by the data-type. For the flexible data-types, this number can be anything.

Examples

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

Previous topic

numpy.dtype.name

Next topic

numpy.dtype.byteorder