MCPcopy Index your code
hub / github.com/numpy/numpy / has_nested_fields

Function has_nested_fields

numpy/lib/_iotools.py:60–82  ·  view source on GitHub ↗

Returns whether one or several fields of a dtype are nested. Parameters ---------- ndtype : dtype Data-type of a structured array. Raises ------ AttributeError If `ndtype` does not have a `names` attribute. Examples -------- >>> import nump

(ndtype)

Source from the content-addressed store, hash-verified

58
59
60def has_nested_fields(ndtype):
61 """
62 Returns whether one or several fields of a dtype are nested.
63
64 Parameters
65 ----------
66 ndtype : dtype
67 Data-type of a structured array.
68
69 Raises
70 ------
71 AttributeError
72 If `ndtype` does not have a `names` attribute.
73
74 Examples
75 --------
76 >>> import numpy as np
77 >>> dt = np.dtype([('name', 'S4'), ('x', float), ('y', float)])
78 >>> np.lib._iotools.has_nested_fields(dt)
79 False
80
81 """
82 return any(ndtype[name].names is not None for name in ndtype.names or ())
83
84
85def flatten_dtype(ndtype, flatten_base=False):

Callers 2

test_has_nested_dtypeMethod · 0.90
genfromtxtFunction · 0.85

Calls 1

anyFunction · 0.85

Tested by 1

test_has_nested_dtypeMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…