On this page
numpy.ma.getmask
- numpy.ma.getmask(a)[source]
- 
    Return the mask of a masked array, or nomask. Return the mask of aas an ndarray ifais aMaskedArrayand the mask is notnomask, else returnnomask. To guarantee a full array of booleans of the same shape as a, usegetmaskarray.- Parameters
- 
      - aarray_like
- 
        Input MaskedArrayfor which the mask is required.
 
 See also - getdata
- 
       Return the data of a masked array as an ndarray. 
- getmaskarray
- 
       Return the mask of a masked array, or full array of False. 
 Examples>>> import numpy.ma as ma >>> a = ma.masked_equal([[1,2],[3,4]], 2) >>> a masked_array( data=[[1, --], [3, 4]], mask=[[False, True], [False, False]], fill_value=2) >>> ma.getmask(a) array([[False, True], [False, False]])Equivalently use the MaskedArraymaskattribute.>>> a.mask array([[False, True], [False, False]])Result when mask == nomask>>> b = ma.masked_array([[1,2],[3,4]]) >>> b masked_array( data=[[1, 2], [3, 4]], mask=False, fill_value=999999) >>> ma.nomask False >>> ma.getmask(b) == ma.nomask True >>> b.mask == ma.nomask True
© 2005–2020 NumPy Developers
Licensed under the 3-clause BSD License.
 https://numpy.org/doc/1.19/reference/generated/numpy.ma.getmask.html