python | Numpy masked_equal() method
With the help of numpy.ma.masked_equal() method, we can get the mask a value that in an array by using numpy.ma.masked_equal() method.
Syntax :
numpy.ma.masked_equal(array, value)Return : Return the array after removing mask value.
Example #1 :
In this example we can see that by using numpy.ma.masked_equal() method, we are able to get the new array after removing mask value which is passed along with an array.
# import numpy import numpy.ma as ma # using numpy.ma.masked_equal() method gfg = ma.masked_equal([1, 2, 3, 4], 3) print(gfg) |
Output :
[1 2 — 4]
Example #2 :
# import numpy import numpy.ma as ma # using numpy.ma.masked_equal() method gfg = ma.masked_equal([[1, 2, 3, 4], [6, 7, 8, 9]], 6) print(gfg) |
Output :
[[1 2 3 4]
[– 7 8 9]]
Recommended Posts:
- Python | numpy.ma.ids() method
- Python | Numpy np.ma.innerproduct() method
- Python | numpy.assert_allclose() method
- Python | Numpy.dsplit() method
- Python | Numpy np.kron() method
- Python | numpy.datetime64() method
- Python | numpy.array_split() method
- Python | Numpy expandtabs() method
- Python | Numpy dstack() method
- Python | Numpy getmask() method
- Python | numpy.fill_diagonal() method
- Python | Numpy getmaskarray() method
- Python | numpy.isnat() method
- Python | Numpy fromrecords() method
- Python | Numpy fromarrays() 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.



