Python | Numpy MaskedArray .__ rrshift__

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 .__ rrshift__ we can get elements that are shifted to the right by the value specified as a parameter.

Syntax: numpy.MaskedArray .__ rrshift__

Return: Return value & gt; & gt; 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 .__ method rrshift __ ()

print (gfg .__ rrshift __ ( 3 )) 

Exit :

 [1 0 0 0 0] 

Example # 2:

# import important module in python

import numpy as np 

 
# make an array with Nu mPy

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

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

 
# applying MaskedArray .__ rrshift __ () method

print (gfg .__ rrshift __ ( 4 )) 

Exit:

 [[2 1 0 0 0] [0 0 0 0 1]] 




Get Solution for free from DataCamp guru