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

Function masked_not_equal

numpy/ma/core.py:2054–2077  ·  view source on GitHub ↗

Mask an array where `not` equal to a given value. This function is a shortcut to ``masked_where``, with `condition` = (x != value). See Also -------- masked_where : Mask where a condition is met. Examples -------- >>> import numpy.ma as ma >>> a = np.arang

(x, value, copy=True)

Source from the content-addressed store, hash-verified

2052
2053
2054def masked_not_equal(x, value, copy=True):
2055 """
2056 Mask an array where `not` equal to a given value.
2057
2058 This function is a shortcut to ``masked_where``, with
2059 `condition` = (x != value).
2060
2061 See Also
2062 --------
2063 masked_where : Mask where a condition is met.
2064
2065 Examples
2066 --------
2067 >>> import numpy.ma as ma
2068 >>> a = np.arange(4)
2069 >>> a
2070 array([0, 1, 2, 3])
2071 >>> ma.masked_not_equal(a, 2)
2072 masked_array(data=[--, --, 2, --],
2073 mask=[ True, True, False, True],
2074 fill_value=999999)
2075
2076 """
2077 return masked_where(not_equal(x, value), x, copy=copy)
2078
2079
2080def masked_equal(x, value, copy=True):

Callers 4

test_testOddFeaturesMethod · 0.90

Calls 2

masked_whereFunction · 0.85
not_equalFunction · 0.50

Tested by 4

test_testOddFeaturesMethod · 0.72