Python | Numpy MaskedArray .__ rlshift__



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

Syntax: numpy.MaskedArray .__ rlshift__

Return: Return value & lt; & lt; self.

Example # 1:
In this example, we see that each element is shifted to the right by the value 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 ]) 

 
# application MaskedArray .__ rlshift __ () method

print (gfg .__ rlshift __ ( 2 )) 

Exit :

 [4 8 16 32 64] 

Example # 2:

# import important module in 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 .__ rlshift method __ ()

print (gfg .__ rlshift __ ( 1 )) 

Exit:

 [[2 4 8 16 32] [64 32 16 8 4]]