Skip to content
Related Articles

Related Articles

Improve Article

numpy.ma.is_mask() function | Python

  • Last Updated : 05 May, 2020

numpy.ma.is_mask() function return True if parameter m is a valid, standard mask. This function does not check the contents of the input, only that the type is MaskType. In particular, this function returns False if the mask has a flexible dtype.

Syntax : numpy.ma.is_mask(m)

Parameter :
m : [array_like] Array to check.
Return : [bool] True if m.dtype.type is MaskType, False otherwise.

Code #1 :




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

Output :



False

 
Code #2 :




# Python program explaining
# numpy.ma.is_mask() function
  
# importing numpy as geek 
# and numpy.ma module as ma 
import numpy as geek 
import numpy.ma as ma 
  
m = [True, False, True]
  
gfg = ma.is_mask(m)
  
print (gfg)

Output :

False

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :