Saturday, November 16, 2024
Google search engine
HomeLanguagesPython | Numpy MaskedArray.__ifloordiv__

Python | Numpy MaskedArray.__ifloordiv__

numpy.ma.MaskedArray class is a subclass of ndarray designed to manipulate numerical arrays with missing data. With the help of Numpy MaskedArray.__ifloordiv__ we can get floor division of particular value that is provided as a parameter in the MaskedArray.__ifloordiv__() method.

Syntax: numpy.MaskedArray.__ifloordiv__(other)

Return: Floor 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.__ifloordiv__().




# import the important module in python 
import numpy as np 
  
# make an array with numpy 
gfg = np.ma.array([10, 20.5, 30, 4.8, 50]) 
  
# applying MaskedArray.__ifloordiv__() method 
print(gfg.__ifloordiv__(2)) 


Output:

[  5.  10.  15.   2.  25.]

 
Example #2:




# import the important module in python 
import numpy as np 
  
# make an array with numpy 
gfg = np.ma.array([[10, 20, 30, 4.45, 50], 
                [6, 5.5, 4, 3, 2.62]]) 
      
  
# applying MaskedArray.__ifloordiv__() method 
print(gfg.__ifloordiv__(5)) 


Output:

[[  2.   4.   6.   0.  10.]
 [  1.   1.   0.   0.   0.]]

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments