  # Python | Numpy method np.ma.common_fill_value ()

Arrays | NumPy | Python Methods and Functions

Using the `np.ma.common_fill_value() ` method, we can get the common fill values ​​from both masked arrays, if they are the same, using ` np.ma .common_fill_value () `.

Syntax: ` np.ma.common_fill_value (array1, array2) `
Return: Return the common filling value from both the arrays.

Example # 1:
In this example, using ` np.ma.common_fill_value () ` we can get common fill values ​​from both masked arrays.

 ` # NumPy import ` ` 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 the np.ma.common_fill_value () method gfg = np.ma.common_fill_value (x, y)   print (gfg) `

Output:

1

Example # 2:

` `

` # NumPy import 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 the np.ma.common_fill_value () method gfg = np.ma.common_fill_value (x, y)   print (gfg) `

` `

Output:

None