Python | Numpy MaskedArray .__ or__

numpy.ma.MaskedArray class is a subclass of ndarray for manipulating numeric arrays with missing data. With the Numpy method MaskedArray .__ or__ we can get elements that are OR by the value supplied as a parameter.

Syntax: numpy.MaskedArray .__ or__

Return: Return self | value.

Example # 1:
In this example, we can see that each element or by the value that is passed as a parameter.

 
# import important module in python

import numpy as np 

 
# make an array with NumPy

gfg = np.ma.array ([ 1 , 2 , 3 , 4 , 5 ]) 

 
# applying the MaskedArray .__ or __ () method

print (gfg .__ or __ ( 2 )) 

Exit :

 [3 2 3 6 7] 

Example # 2:

# import an important module in python

import numpy as np 

 
# make m assiv with NumPy

gfg = np. ma.array ([[ 1 , 2 , 3 , 4 , 5 ], 

[ 6 , 5 , 4 , 3 , 2 ] ]) 

 
# applying the MaskedArray method .__ or __ ()

print (gfg .__ or __ ( 1 )) 

Exit:

 [[1 3 3 5 5] [7 5 5 3 3]]