Python | Numpy np.ma.common_fill_value() method
Last Updated :
03 Nov, 2019
With the help of np.ma.common_fill_value()
method, we can get the common filling values from both the masked array if same by using np.ma.common_fill_value()
method.
Syntax : np.ma.common_fill_value(array1, array2)
Return : Return the common filling value from both the arrays.
Example #1 :
In this example by using np.ma.common_fill_value()
method, we are able to get the common filling values from both the masked arrays.
import numpy as np
x = np.ma.array([ 1 , 2 , 3 ], fill_value = 1 )
y = np.ma.array([ 7 , 8 , 9 ], fill_value = 1 )
gfg = np.ma.common_fill_value(x, y)
print (gfg)
|
Output :
1
Example #2 :
import numpy as np
x = np.ma.array([[ 1 , 2 ], [ 2 , 1 ]], fill_value = 2 )
y = np.ma.array([[ 1 , 5 ], [ 5 , 1 ]], fill_value = 5 )
gfg = np.ma.common_fill_value(x, y)
print (gfg)
|
Output :
None
Share your thoughts in the comments
Please Login to comment...