numpy.lib.format.dtype_to_descr#

lib.format.dtype_to_descr(dtype)[源代码]#

从 dtype 获取可序列化的描述符.

dtype 对象的 .descr 属性不能通过 dtype() 构造函数进行往返. 简单类型,如 dtype(‘float32’),有一个 descr,它看起来像一个记录数组,其中一个字段的名称为 ‘’. dtype() 构造函数将其解释为请求提供默认名称. 相反,我们构造可以传递给 dtype() 的描述符.

参数:
dtypedtype

将要写入磁盘的数组的 dtype.

返回:
descrobject

可以传递给 numpy.dtype() 以复制输入 dtype 的对象.