bundles / numpy latest / numpy / ma / core / getmask
function
numpy.ma.core:getmask
source: build-install/usr/lib/python3.14/site-packages/numpy/ma/core.py :1400
Signature
def getmask ( a ) Summary
Return the mask of a masked array, or nomask.
Extended Summary
Return the mask of a as an ndarray if a is a MaskedArray and the mask is not nomask, else return nomask. To guarantee a full array of booleans of the same shape as a, use getmaskarray.
Parameters
a: array_likeInput MaskedArray for which the mask is required.
Examples
import numpy as np import numpy.ma as ma a = ma.masked_equal([[1,2],[3,4]], 2) a ma.getmask(a)Equivalently use the `MaskedArray` `mask` attribute.
a.mask
Result when mask == `nomask`
b = ma.masked_array([[1,2],[3,4]]) b ma.nomask ma.getmask(b) == ma.nomask b.mask == ma.nomask
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.
Aliases
-
numpy.ma.getmask