Open In App

Python | Numpy MaskedArray.__ifloordiv__

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.__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.]]

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads