numpy.ma.is_mask() function | Python (original) (raw)

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 :

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 :

import numpy as geek

import numpy.ma as ma

m = [ True , False , True ]

gfg = ma.is_mask(m)

print (gfg)

Output :

False

Similar Reads