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

Method __getitem__

numpy/ma/core.py:2649–2661  ·  view source on GitHub ↗
(self, indx)

Source from the content-addressed store, hash-verified

2647 return self
2648
2649 def __getitem__(self, indx):
2650 result = self.dataiter.__getitem__(indx).view(type(self.ma))
2651 if self.maskiter is not None:
2652 _mask = self.maskiter.__getitem__(indx)
2653 if isinstance(_mask, ndarray):
2654 # set shape to match that of data; this is needed for matrices
2655 _mask.shape = result.shape
2656 result._mask = _mask
2657 elif isinstance(_mask, np.void):
2658 return mvoid(result, mask=_mask, hardmask=self.ma._hardmask)
2659 elif _mask: # Just a scalar, masked
2660 return masked
2661 return result
2662
2663 # This won't work if ravel makes a copy
2664 def __setitem__(self, index, value):

Callers

nothing calls this directly

Calls 3

mvoidClass · 0.85
viewMethod · 0.45
__getitem__Method · 0.45

Tested by

no test coverage detected