Open In App

python | Numpy masked_equal() method

Last Updated : 19 Sep, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
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. Python3 1=1
# 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 : Python3 1=1
# 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]]

Next Article
Article Tags :
Practice Tags :

Similar Reads