Open In App

Python | Numpy MaskedArray.__itruediv__

Last Updated : 12 Apr, 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.__itruediv__ we can ma particular value that is provided as a parameter in the MaskedArray.__itruediv__() method.

Syntax: numpy.MaskedArray.__itruediv__(other)

Return: True divide self by other in-place.

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.__itruediv__().




# 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.__itruediv__() method 
print(gfg.__itruediv__(2)) 


Output:

[ 0.5   1.25  1.5   2.4   2.5 ]

 
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.__itruediv__() method 
print(gfg.__itruediv__(5)) 


Output:

[[ 0.2    0.4    0.6    0.89   1.   ]
 [ 1.2    1.1    0.8    0.6    0.524]]

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads