[ Web Proxy ]
URL:
Viewing: https://numpy.org/doc/stable/reference/generated/../random/../generated/numpy.ma.mask_or.html [Back]  [Original]

numpy.ma.mask_or — NumPy v2.5 Manual
Back to top
Search the docs ...:

numpy.ma.mask_or#

ma.mask_or(m1, m2, copy=False, shrink=True)[source]#

Combine two masks with the logical_or operator.

The result may be a view on m1 or m2 if the other is nomask (i.e. False).

Parameters:
m1, m2array_like

Input masks.

copybool, optional

If copy is False and one of the inputs is nomask, return a view of the other input mask. Defaults to False.

shrinkbool, optional

Whether to shrink the output to nomask if all its values are False. Defaults to True.

Returns:
maskoutput mask

The result masks values that are masked in either m1 or m2.

Raises:
ValueError

If m1 and m2 have different flexible dtypes.

Examples

Try it in your browser!
>>> import numpy as np
>>> m1 = np.ma.make_mask([0, 1, 1, 0])
>>> m2 = np.ma.make_mask([1, 0, 0, 0])
>>> np.ma.mask_or(m1, m2)
array([ True,  True,  True, False])

Web Proxy Viewer  |  New URL  |  Original Page