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

Method __getitem__

numpy/ma/core.py:6575–6595  ·  view source on GitHub ↗

Get the index.

(self, indx)

Source from the content-addressed store, hash-verified

6573 return super()._data[()]
6574
6575 def __getitem__(self, indx):
6576 """
6577 Get the index.
6578
6579 """
6580 m = self._mask
6581 if isinstance(m[indx], ndarray):
6582 # Can happen when indx is a multi-dimensional field:
6583 # A = ma.masked_array(data=[([0,1],)], mask=[([True,
6584 # False],)], dtype=[("A", ">i2", (2,))])
6585 # x = A[0]; y = x["A"]; then y.mask["A"].size==2
6586 # and we can not say masked/unmasked.
6587 # The result is no longer mvoid!
6588 # See also issue #6724.
6589 return masked_array(
6590 data=self._data[indx], mask=m[indx],
6591 fill_value=self._fill_value[indx],
6592 hard_mask=self._hardmask)
6593 if m is not nomask and m[indx]:
6594 return masked
6595 return self._data[indx]
6596
6597 def __setitem__(self, indx, value):
6598 self._data[indx] = value

Callers 3

__getitem__Method · 0.45
time_methods_getitemMethod · 0.45
time_methods_getitemMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected