Python | Numpy MaskedArray.__ifloordiv__
Last Updated :
12 Apr, 2019
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 numpy as np
gfg = np.ma.array([ 10 , 20.5 , 30 , 4.8 , 50 ])
print (gfg.__ifloordiv__( 2 ))
|
Output:
[ 5. 10. 15. 2. 25.]
Example #2:
import numpy as np
gfg = np.ma.array([[ 10 , 20 , 30 , 4.45 , 50 ],
[ 6 , 5.5 , 4 , 3 , 2.62 ]])
print (gfg.__ifloordiv__( 5 ))
|
Output:
[[ 2. 4. 6. 0. 10.]
[ 1. 1. 0. 0. 0.]]
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...