numpy.dtype.subdtype#

attribute

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