Open In App

Python | Numpy MaskedArray.__rtruediv__

Last Updated : 27 Mar, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__rtruediv__ we can divide a particular value that is provided 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 can see that each and every element in an array is divided with the value given as a parameter in method MaskedArray.__rtruediv__().




# import the 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)) 


Output:

[0.5 0.3333333333333333 0.25 0.2 0.14285714285714285]

 
Example #2:




# import the 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.__rtruediv__() method 
print(gfg.__rtruediv__(10)) 


Output:

[[1.0 0.5 0.3333333333333333 0.25 0.2]
 [0.09090909090909091 0.045454545454545456 0.030303030303030304
  0.022727272727272728 0.01818181818181818]]

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads