Python | Numpy MaskedArray .__ rtruediv__

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 .__ rtruediv__ we can split a specific value that is supplied as a parameter in the MaskedArray .__ rtruediv __ () method.

Syntax: numpy.MaskedArray .__ rtruediv__

Return: Divide self into others, and return a new masked array.

Example # 1:
In this example, we see that each element of the array is divisible with the value specified as a parameter in the MaskedArray method .__ rtruediv __ ().

# import important module in python

import numpy as np 

 
# make an array with NumPy

gfg = np. ma.array ([ 22 , 33 , 44 , 55 , 77 ]) 

 
# applying MaskedArray .__ rtruediv __ () method

print (gfg .__ rtruediv __ ( 11 )) 

Exit:

 [0.5 0.3333333333333333 0.25 0.2 0.14285714285714285] 

Example # 2:

# import important module in python

import numpy as np 

 
# make an array with NumPy

gfg = np.ma.array ([[ 10 , 20 , 30 , 40 , 50 ], 

[ 110 , 220 , 330 , 440 , 550 ]]) 

 
# applying MaskedArray .__ rtrue method div __ ()

print (gfg .__ rtruediv __ ( 10 )) 

Output:

 [[1.0 0.5 0.33333333333333 0.25 0.2] [0.090909090909091 0.045454545454545456 0.030303030303030304 0.022727272727272728 0.01818181818181818]] 




Get Solution for free from DataCamp guru