Friday, May 8, 2026
HomeLanguagesPython | Numpy MaskedArray.__itruediv__

Python | Numpy MaskedArray.__itruediv__

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]]
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32514 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6892 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12107 POSTS0 COMMENTS
Shaida Kate Naidoo
7016 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6975 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS