-
dtype.fields
-
Dictionary of named fields defined for this data type, or
None
.The dictionary is indexed by keys that are the names of the fields. Each entry in the dictionary is a tuple fully describing the field:
1(dtype, offset[, title])
If present, the optional title can be any object (if it is a string or unicode then it will also be a key in the fields dictionary, otherwise it?s meta-data). Notice also that the first two elements of the tuple can be passed directly as arguments to the
ndarray.getfield
andndarray.setfield
methods.See also
Examples
123>>> dt
=
np.dtype([(
'name'
, np.str_,
16
), (
'grades'
, np.float64, (
2
,))])
>>>
print
(dt.fields)
{
'grades'
: (dtype((
'float64'
,(
2
,))),
16
),
'name'
: (dtype(
'|S16'
),
0
)}
dtype.fields

2025-01-10 15:47:30
Please login to continue.