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

Method any

numpy/ma/core.py:4948–4976  ·  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

4946 return out
4947
4948 def any(self, axis=None, out=None, keepdims=np._NoValue):
4949 """
4950 Returns True if any of the elements of `a` evaluate to True.
4951
4952 Masked values are considered as False during computation.
4953
4954 Refer to `numpy.any` for full documentation.
4955
4956 See Also
4957 --------
4958 numpy.ndarray.any : corresponding function for ndarrays
4959 numpy.any : equivalent function
4960
4961 """
4962 kwargs = {} if keepdims is np._NoValue else {'keepdims': keepdims}
4963
4964 mask = _check_mask_axis(self._mask, axis, **kwargs)
4965 if out is None:
4966 d = self.filled(False).any(axis=axis, **kwargs).view(type(self))
4967 if d.ndim:
4968 d.__setmask__(mask)
4969 elif mask:
4970 d = masked
4971 return d
4972 self.filled(False).any(axis=axis, out=out, **kwargs)
4973 if isinstance(out, MaskedArray):
4974 if out.ndim or mask:
4975 out.__setmask__(mask)
4976 return out
4977
4978 def nonzero(self):
4979 """

Callers 15

test_shuffleMethod · 0.45
test_permutationMethod · 0.45
linspaceFunction · 0.45
geomspaceFunction · 0.45
test_nans_infsMethod · 0.45
test_half_orderingMethod · 0.45

Calls 4

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