Open In App

Numpy MaskedArray.common_fill_value() function | Python

Last Updated : 29 Oct, 2019
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report
numpy.MaskedArray.common_fill_value() function is used to return the common filling value between two masked arrays.If arr1.fill_value == arr2.fill_value then it returns the fill value, otherwise return None.
Syntax : numpy.ma.common_fill_value(arr1, arr2) Parameters: arr1, arr2 :[ MaskedArray ] The masked arrays for which to compare fill values. Return : [ scalar or None] The common fill value or None.
Code #1 :
Output:
1st Input array :  [[ 1  2]
 [ 3 -1]
 [ 5 -3]]
2nd Input array :  [[ 10  20]
 [ 30 -10]
 [ 50 -30]]
1st Masked array :  [[-- 2]
 [-- -1]
 [5 -3]]
2nd Masked array :  [[-- --]
 [-- -10]
 [50 -30]]
common filled value :  5
  Code #2 :
Output:
1st Input array :  [[ 1  2]
 [ 3 -1]
 [ 5 -3]]
2nd Input array :  [[ 10  20]
 [ 30 -10]
 [ 50 -30]]
1st Masked array :  [[-- 2]
 [-- -1]
 [5 -3]]
2nd Masked array :  [[-- --]
 [-- -10]
 [50 -30]]
common filled value :  None

Next Article
Practice Tags :

Similar Reads