bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / lib / _iotools / easy_dtype
function
numpy.lib._iotools:easy_dtype
source: build-install/usr/lib/python3.14/site-packages/numpy/lib/_iotools.py:824
Signature
def easy_dtype(ndtype, names = None, defaultfmt = f%i, **validationargs)Summary
Convenience function to create a np.dtype object.
Extended Summary
The function processes the input dtype and matches it with the given names.
Parameters
ndtype: varDefinition of the dtype. Can be any string or dictionary recognized by the
np.dtypefunction, or a sequence of types.names: str or sequence, optionalSequence of strings to use as field names for a structured dtype. For convenience,
namescan be a string of a comma-separated list of names.defaultfmt: str, optionalFormat string used to define missing names, such as
"f%i"(default) or"fields_%02i".validationargs: optionalA series of optional arguments used to initialize a NameValidator.
Examples
import numpy as np np.lib._iotools.easy_dtype(float) np.lib._iotools.easy_dtype("i4, f8") np.lib._iotools.easy_dtype("i4, f8", defaultfmt="field_%03i")✓
dtype([('field_000', '<i4'), ('field_001', '<f8')])
np.lib._iotools.easy_dtype((int, float, float), names="a,b,c") np.lib._iotools.easy_dtype(float, names="a,b,c")✓
dtype([('a', '<f8'), ('b', '<f8'), ('c', '<f8')])
Aliases
numpy.lib._iotools.easy_dtype