Python | Numpy MaskedArray .__ ror__

Arrays | NumPy | Python Methods and Functions

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

Syntax: numpy.MaskedArray .__ ror__

Return: Return value | self.

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

   
# import an important module in python

import numpy as np 

 
# make an array with NumPy

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

  
# applying MaskedArray .__ ror __ () method

print (gfg .__ ror __ ( 2 )) 

Exit:

 [3 2 3 6 7] 

Example # 2:

# import important module into python

import numpy as np 

 
# make an array with NumPy

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

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

 
# applying MaskedArray .__ ror __ () method

print (gfg .__ ror __ ( 1 )) 

Exit:

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



Get Solution for free from DataCamp guru