numpy.dtype.subdtype#

属性

dtype.subdtype#

如果此 dtype 描述了一个子数组,则返回 (item_dtype, shape) 元组,否则返回 None。

shape 是此数据类型描述的子数组的固定形状,item_dtype 是数组的数据类型。

如果检索到的字段的 dtype 对象具有此属性,则 shape 暗示的额外维度将被附加到检索到的数组的末尾。

另请参阅

dtype.base

示例

>>> import numpy as np
>>> x = np.dtype('8f')
>>> x.subdtype
(dtype('float32'), (8,))
>>> x =  np.dtype('i2')
>>> x.subdtype
>>>