Friday, November 21, 2025
HomeLanguagesPython | Numpy MaskedArray.__rmod__

Python | Numpy MaskedArray.__rmod__

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)) 


Output:

[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)) 


Output:

[[0.0 1.0 0.0 3.0 3.0]
 [3.0 3.0 3.0 0.0 0.3799999999999999]]
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32405 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6781 POSTS0 COMMENTS
Nicole Veronica
11928 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11997 POSTS0 COMMENTS
Shaida Kate Naidoo
6907 POSTS0 COMMENTS
Ted Musemwa
7166 POSTS0 COMMENTS
Thapelo Manthata
6862 POSTS0 COMMENTS
Umr Jansen
6847 POSTS0 COMMENTS