Open In App

Python | Numpy np.ma.common_fill_value() method

Last Updated : 03 Nov, 2019
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report
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. Python3 1=1
# import numpy
import numpy as np

x = np.ma.array([1, 2, 3], fill_value = 1)
y = np.ma.array([7, 8, 9], fill_value = 1)

# using np.ma.common_fill_value() method
gfg = np.ma.common_fill_value(x, y)

print(gfg)
Output :
1
Example #2 : Python3 1=1
# import numpy
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)

# using np.ma.common_fill_value() method
gfg = np.ma.common_fill_value(x, y)

print(gfg)
Output :
None

Similar Reads