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

Method field

numpy/_core/records.py:539–554  ·  view source on GitHub ↗
(self, attr, val=None)

Source from the content-addressed store, hash-verified

537 return fmt % (lst, lf, repr_dtype)
538
539 def field(self, attr, val=None):
540 if isinstance(attr, int):
541 names = ndarray.__getattribute__(self, 'dtype').names
542 attr = names[attr]
543
544 fielddict = ndarray.__getattribute__(self, 'dtype').fields
545
546 res = fielddict[attr][:2]
547
548 if val is None:
549 obj = self.getfield(*res)
550 if obj.dtype.names is not None:
551 return obj
552 return obj.view(ndarray)
553 else:
554 return self.setfield(val, *res)
555
556
557def _deprecate_shape_0_as_None(shape):

Callers

nothing calls this directly

Calls 2

__getattribute__Method · 0.45
viewMethod · 0.45

Tested by

no test coverage detected