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

Method __getitem__

numpy/ma/core.py:6375–6395  ·  view source on GitHub ↗

Get the index.

(self, indx)

Source from the content-addressed store, hash-verified

6373 return super()._data[()]
6374
6375 def __getitem__(self, indx):
6376 """
6377 Get the index.
6378
6379 """
6380 m = self._mask
6381 if isinstance(m[indx], ndarray):
6382 # Can happen when indx is a multi-dimensional field:
6383 # A = ma.masked_array(data=[([0,1],)], mask=[([True,
6384 # False],)], dtype=[("A", ">i2", (2,))])
6385 # x = A[0]; y = x["A"]; then y.mask["A"].size==2
6386 # and we can not say masked/unmasked.
6387 # The result is no longer mvoid!
6388 # See also issue #6724.
6389 return masked_array(
6390 data=self._data[indx], mask=m[indx],
6391 fill_value=self._fill_value[indx],
6392 hard_mask=self._hardmask)
6393 if m is not nomask and m[indx]:
6394 return masked
6395 return self._data[indx]
6396
6397 def __setitem__(self, indx, value):
6398 self._data[indx] = value

Callers 1

__getitem__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected