numpy.dtype.subdtype#

屬性

dtype.subdtype#

若此 dtype 描述子陣列,則為元組 (item_dtype, shape),否則為 None。

shape 是此資料型別描述的子陣列的固定形狀,而 item_dtype 是陣列的資料型別。

如果檢索到 dtype 物件具有此屬性的欄位,則 shape 暗示的額外維度會附加到檢索到的陣列末尾。

另請參閱

dtype.base

範例

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