numpy.lib.format.descr_to_dtype#

lib.format.descr_to_dtype(descr)[源码]#

根据给定的描述返回一个 dtype。

这本质上是 dtype_to_descr 的反向操作。它将移除由简单字段(例如 dtype('float32'))创建的无值填充字段,然后将描述转换为相应的 dtype。

参数:
descrobject

通过 dtype.descr 检索到的对象。可以将其传递给 numpy.dtype 以复制输入 dtype。

返回:
dtypedtype

由描述构造的 dtype。