numpy.lib.format.dtype_to_descr#
- lib.format.dtype_to_descr(dtype)[源代码]#
从 dtype 获取一个可序列化的描述符.
dtype 对象的 .descr 属性不能通过 dtype() 构造函数进行往返转换.简单类型,如 dtype(‘float32’),有一个 descr,看起来像一个包含一个字段且名称为 ‘’ 的记录数组.dtype() 构造函数将此解释为请求提供默认名称.相反,我们构建可以传递给 dtype() 的描述符.
- 参数:
- dtypedtype
将要写入磁盘的数组的 dtype.
- 返回:
- descr对象
一个可以传递给 numpy.dtype() 的对象,以便复制输入的 dtype.