numpy 1.22.4 Pypi GitHub Homepage
Other Docs
Parameters
easy_dtype(ndtype, names=None, defaultfmt='f%i', **validationargs)

The function processes the input dtype and matches it with the given names.

Parameters

ndtype : var

Definition of the dtype. Can be any string or dictionary recognized by the :None:None:`np.dtype` function, or a sequence of types.

names : str or sequence, optional

Sequence of strings to use as field names for a structured dtype. For convenience, :None:None:`names` can be a string of a comma-separated list of names.

defaultfmt : str, optional

Format string used to define missing names, such as "f%i" (default) or "fields_%02i" .

validationargs : optional

A series of optional arguments used to initialize a NameValidator .

Convenience function to create a :None:None:`np.dtype` object.

Examples

>>> np.lib._iotools.easy_dtype(float)
dtype('float64')
>>> np.lib._iotools.easy_dtype("i4, f8")
dtype([('f0', '<i4'), ('f1', '<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")
dtype([('a', '<i8'), ('b', '<f8'), ('c', '<f8')])
>>> np.lib._iotools.easy_dtype(float, names="a,b,c")
dtype([('a', '<f8'), ('b', '<f8'), ('c', '<f8')])
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/lib/_iotools.py#822
type: <class 'function'>
Commit: