numpy.lib.format.descr_to_dtype#

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

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

这本质上是 dtype_to_descr 的逆操作。它将移除由 dtype('float32') 等简单字段创建的无值填充字段,然后将该描述转换为其对应的 dtype。

参数:
descr对象

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

返回:
dtypedtype

根据描述构建的 dtype。