Open In App

numpy.ma.is_mask() function | Python

Improve
Improve
Like Article
Like
Save
Share
Report

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

Last Updated : 05 May, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads