MCPcopy Create free account
hub / github.com/numpy/numpy / field

Method field

numpy/core/records.py:558–573  ·  view source on GitHub ↗
(self, attr, val=None)

Source from the content-addressed store, hash-verified

556 return fmt % (lst, lf, repr_dtype)
557
558 def field(self, attr, val=None):
559 if isinstance(attr, int):
560 names = ndarray.__getattribute__(self, 'dtype').names
561 attr = names[attr]
562
563 fielddict = ndarray.__getattribute__(self, 'dtype').fields
564
565 res = fielddict[attr][:2]
566
567 if val is None:
568 obj = self.getfield(*res)
569 if obj.dtype.names is not None:
570 return obj
571 return obj.view(ndarray)
572 else:
573 return self.setfield(val, *res)
574
575
576def _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