numpy.dtype.descr#
属性
- dtype.descr#
数据类型的
__array_interface__描述.格式是 `__ array_interface__ ` 属性中 ‘descr’ 键所要求的格式.
警告:此属性专门为 __ array_interface__ 存在,直接将其传递给
numpy.dtype将无法准确地重建某些 dtype(例如,标量和子数组 dtype).示例
>>> import numpy as np >>> x = np.dtype(float) >>> x.descr [('', '<f8')]
>>> dt = np.dtype([('name', np.str_, 16), ('grades', np.float64, (2,))]) >>> dt.descr [('name', '<U16'), ('grades', '<f8', (2,))]