numpy.ma.masked_not_equal#

ma.masked_not_equal(x, value, copy=True)[來源]#

遮罩陣列中*不*等於給定值的位置。

此函式是 masked_where 的捷徑,其中 condition = (x != value)。

參見

masked_where

遮罩符合條件的位置。

範例

>>> import numpy as np
>>> import numpy.ma as ma
>>> a = np.arange(4)
>>> a
array([0, 1, 2, 3])
>>> ma.masked_not_equal(a, 2)
masked_array(data=[--, --, 2, --],
             mask=[ True,  True, False,  True],
       fill_value=999999)