MCPcopy
hub / github.com/numpy/numpy / any

Method any

numpy/ma/core.py:5019–5047  ·  view source on GitHub ↗

Returns True if any of the elements of `a` evaluate to True. Masked values are considered as False during computation. Refer to `numpy.any` for full documentation. See Also -------- numpy.ndarray.any : corresponding function for ndarrays nu

(self, axis=None, out=None, keepdims=np._NoValue)

Source from the content-addressed store, hash-verified

5017 return out
5018
5019 def any(self, axis=None, out=None, keepdims=np._NoValue):
5020 """
5021 Returns True if any of the elements of `a` evaluate to True.
5022
5023 Masked values are considered as False during computation.
5024
5025 Refer to `numpy.any` for full documentation.
5026
5027 See Also
5028 --------
5029 numpy.ndarray.any : corresponding function for ndarrays
5030 numpy.any : equivalent function
5031
5032 """
5033 kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims}
5034
5035 mask = _check_mask_axis(self._mask, axis, **kwargs)
5036 if out is None:
5037 d = self.filled(False).any(axis=axis, **kwargs).view(type(self))
5038 if d.ndim:
5039 d.__setmask__(mask)
5040 elif mask:
5041 d = masked
5042 return d
5043 self.filled(False).any(axis=axis, out=out, **kwargs)
5044 if isinstance(out, MaskedArray):
5045 if out.ndim or mask:
5046 out.__setmask__(mask)
5047 return out
5048
5049 def nonzero(self):
5050 """

Callers 15

test_shuffleMethod · 0.45
test_permutationMethod · 0.45
linspaceFunction · 0.45
geomspaceFunction · 0.45
multiplyFunction · 0.45
centerFunction · 0.45
ljustFunction · 0.45

Calls 4

filledMethod · 0.95
_check_mask_axisFunction · 0.85
__setmask__Method · 0.80
viewMethod · 0.45

Tested by 15

test_shuffleMethod · 0.36
test_permutationMethod · 0.36
test_isnanFunction · 0.36
test_cast_to_boolFunction · 0.36
test_nans_infsMethod · 0.36
test_half_orderingMethod · 0.36