MCPcopy
hub / github.com/numpy/numpy / masked_equal

Function masked_equal

numpy/ma/core.py:2143–2173  ·  view source on GitHub ↗

Mask an array where equal to a given value. Return a MaskedArray, masked where the data in array `x` are equal to `value`. The fill_value of the returned MaskedArray is set to `value`. For floating point arrays, consider using ``masked_values(x, value)``. See Also ---

(x, value, copy=True)

Source from the content-addressed store, hash-verified

2141
2142
2143def masked_equal(x, value, copy=True):
2144 """
2145 Mask an array where equal to a given value.
2146
2147 Return a MaskedArray, masked where the data in array `x` are
2148 equal to `value`. The fill_value of the returned MaskedArray
2149 is set to `value`.
2150
2151 For floating point arrays, consider using ``masked_values(x, value)``.
2152
2153 See Also
2154 --------
2155 masked_where : Mask where a condition is met.
2156 masked_values : Mask using floating point equality.
2157
2158 Examples
2159 --------
2160 >>> import numpy as np
2161 >>> import numpy.ma as ma
2162 >>> a = np.arange(4)
2163 >>> a
2164 array([0, 1, 2, 3])
2165 >>> ma.masked_equal(a, 2)
2166 masked_array(data=[0, 1, --, 3],
2167 mask=[False, False, True, False],
2168 fill_value=2)
2169
2170 """
2171 output = masked_where(equal(x, value), x, copy=copy)
2172 output.fill_value = value
2173 return output
2174
2175
2176def masked_inside(x, v1, v2, copy=True):

Calls 2

masked_whereFunction · 0.85
equalFunction · 0.85

Used in the wild real call sites across dependent graphs

searching dependent graphs…