Python | Numpy MaskedArray .__ irshift __ ()



numpy.ma.MaskedArray class is a subclass of ndarray for manipulating numeric arrays with missing data. With Numpy MaskedArray .__ irshift__ we can get items that are shifted to the right by the value provided as a parameter in the MaskedArray .__ irshift __ () method.

Syntax: numpy.MaskedArray .__ irshift __ (other)

Return: Return self & gt; & gt; = value.

Example # 1:
In this example, we see that each element is shifted to the right by the value passed as a parameter to the MaskedArray method .__ irshift __ ().

# import an important module into python

import numpy as np 

 
# make an array with NumPy

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

  
# applying MaskedArray .__ irshift __ () method

print (gfg .__ irshift __ ( 2 )) 

Exit:

 [0 0 0 1 1] 

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 .__ irshift method __ ()

print (gfg .__ irshift __ ( 1 )) 

Exit:

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