numpy.ma.masked_less_equal#

ma.masked_less_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_less_equal(a, 2)
masked_array(data=[--, --, --, 3],
             mask=[ True,  True,  True, False],
       fill_value=999999)