Python | Numpy getmaskarray() method
With the help of numpy.getmaskarray() method, we can get the masked matrix in the form numpy array which shows masked values by using numpy.getmaskarray() method.
Syntax :
numpy.getmaskarray(array)Return : Return masked values in the form of numpy array.
Example #1 :
In this example we can see that by using numpy.getmaskarray() method, we are able to get the masked matrix in the form of numpy array.
# import numpy import numpy.ma as ma gfg = ma.masked_equal([[1, 2], [5, 6]], 5) # using numpy.getmaskarray() method print(ma.getmaskarray(gfg)) |
Output :
array([[False False]
[True False]])
Example #2 :
# import numpy import numpy.ma as ma gfg = ma.masked_equal([11, 12, 13, 14, 15], 12) # using numpy.getmaskarray() method print(ma.getmaskarray(gfg)) |
Output :
array([False True False False False])
Recommended Posts:
- Python | numpy.ma.ids() method
- Python | Numpy np.logseries() method
- Python | Numpy.expand_dims() method
- Python | Numpy.broadcast_arrays() method
- Python | numpy.array_split() method
- Python | Numpy.dsplit() method
- Python | numpy.assert_allclose() method
- Python | Numpy np.lognormal() method
- Python | numpy.datetime64() method
- Python | Numpy np.negative_binomial() method
- Python | Numpy np.multivariate_normal() method
- Python | Numpy np.multinomial() method
- Python | numpy.putmask() method
- Python | Numpy expandtabs() method
- Python | numpy.lookfor() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



