{ } Raw JSON

bundles / numpy 2.4.4 / numpy / lib / _iotools / flatten_dtype

function

numpy.lib._iotools:flatten_dtype

source: /numpy/lib/_iotools.py :85

Signature

def   flatten_dtype ( ndtype flatten_base = False )

Summary

Unpack a structured data-type by collapsing nested fields and/or fields with a shape.

Extended Summary

Note that the field names are lost.

Parameters

ndtype : dtype

The datatype to collapse

flatten_base : bool, optional

If True, transform a field with a shape into several fields. Default is False.

Examples

import numpy as np
dt = np.dtype([('name', 'S4'), ('x', float), ('y', float),
               ('block', int, (2, 3))])
np.lib._iotools.flatten_dtype(dt)
np.lib._iotools.flatten_dtype(dt, flatten_base=True)

Aliases

  • numpy.lib._iotools.flatten_dtype