📜  numpy.ma.is_masked()函数| Python

📅  最后修改于: 2022-05-13 01:55:37.982000             🧑  作者: Mango

numpy.ma.is_masked()函数| Python

numpy.ma.is_masked()函数确定输入是否具有屏蔽值并接受任何对象作为输入,但始终返回 False,除非输入是包含屏蔽值的 MaskedArray。

代码#1:

# Python program explaining
# numpy.ma.is_masked() function
  
# importing numpy as geek 
# and numpy.ma module as ma 
import numpy as geek 
import numpy.ma as ma 
  
arr = ma.masked_equal([0, 1, 2, 0, 3], 0)
  
gfg = ma.is_masked(arr)
  
  
print (gfg)

输出 :

True


代码#2:

# Python program explaining
# numpy.ma.is_masked() function
  
# importing numpy as geek 
# and numpy.ma module as ma 
import numpy as geek 
import numpy.ma as ma 
  
arr = [True, False, True]
  
# always returns False unless
# the input is a MaskedArray 
gfg = ma.is_masked(arr)
  
print (gfg)

输出 :

False