numpy.ma.MaskedArray class
is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__rmod__ every element in masked array is operated on binary operator i.e mod(%). Remember we can use any type of values in an array and value for mod is applied as the parameter in MaskedArray.__rmod__().
Syntax: numpy.MaskedArray.__rmod__
Return: Return value%self.
Example #1 :
We can see that value that we have passed through MaskedArray.__rmod__() method is used to perform the mod operation with every element of an array.
# import the important module in python import numpy as np # make an array with numpy gfg = np.ma.array([ 1 , 2.5 , 3 , 4.8 , 5 ]) # applying MaskedArray.__rmod__() method print (gfg.__rmod__( 2 )) |
[0.0 2.0 2.0 2.0 2.0]
Example #2:
# import the important module in python import numpy as np # make an array with numpy gfg = np.ma.array([[ 1 , 2 , 3 , 4.45 , 5 ], [ 6 , 5.5 , 4 , 3 , 2.62 ]]) # applying MaskedArray.__rmod__() method print (gfg.__rmod__( 3 )) |
[[0.0 1.0 0.0 3.0 3.0] [3.0 3.0 3.0 0.0 0.3799999999999999]]