NumPy

Previous topic

numpy.dtype.subdtype

Next topic

numpy.dtype.hasobject

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

numpy.dtype.shape

attribute

dtype.shape

Shape tuple of the sub-array if this data type describes a sub-array, and () otherwise.

Examples

>>>
>>> dt = np.dtype(('i4', 4))
>>> dt.shape
(4,)
>>>
>>> dt = np.dtype(('i4', (2, 3)))
>>> dt.shape
(2, 3)