  # Python | Numpy MaskedArray .__ rdivmod__

Arrays | NumPy | Python Methods and Functions

` numpy.ma.MaskedArray class ` is a subclass of ndarray for manipulating numeric arrays with missing data. With Numpy MaskedArray .__ rdivmod__ we will get two arrays, one of which has elements that are divisible by the values ​​provided in the numpy.ma .__ rdivmod __ () method, and the second — elements that perform a mod operation with the same value as in numpy. .ma .__ rdivmod __ () method.

Return: Return divmod (value, self).

Example # 1:
In this example, we can see that using the MaskedArray method .__ rdivmod __ ( ) we get two arrays. One with a division with the value that is passed as a parameter, and the other with the values ​​of the mod.

 ` # import important module in python ` ` import ` ` numpy as np ` `   # make an array with NumPy `` gfg = np.ma.array ([ 1 , 2 , 3 , 4 , 5 ] )    # applying MaskedArray .__ method rdivmod __ ()   print (gfg .__ rdivmod __ ( 3 )) `

Exit:

` (masked_array (data = [3 1 1 0 0], mask = [False False False False False], fill_value = 999999), masked_array (data = [0 1 0 3 3], mask = [False False False False False], fill_value = 999999)) `

Example # 2:

 ` # import an 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 .__ method rdivmod __ () print (gfg .__ rdivmod __ ( 3 )) `

Output:

` (masked_array (data = [[3 1 1 0 0] [0 0 0 1 1]], mask = [[False False False False False] [False False Fa lse False False]], fill_value = 999999), masked_array (data = [[0 1 0 3 3] [3 3 3 0 1]], mask = [[False False False False False] [False False False False False]] , fill_value = 999999)) `