{ } Raw JSON

bundles / numpy 2.4.4 / numpy / lib / format / dtype_to_descr

function

numpy.lib.format:dtype_to_descr

source: /numpy/lib/_format_impl.py :250

Signature

def   dtype_to_descr ( dtype )

Summary

Get a serializable descriptor from the dtype.

Extended Summary

The .descr attribute of a dtype object cannot be round-tripped through the dtype() constructor. Simple types, like dtype('float32'), have a descr which looks like a record array with one field with '' as a name. The dtype() constructor interprets this as a request to give a default name. Instead, we construct descriptor that can be passed to dtype().

Parameters

dtype : dtype

The dtype of the array that will be written to disk.

Returns

descr : object

An object that can be passed to numpy.dtype() in order to replicate the input dtype.

Aliases

  • numpy.lib._format_impl.dtype_to_descr