MCPcopy Create free account
hub / github.com/numpy/numpy / common_fill_value

Function common_fill_value

numpy/ma/core.py:555–584  ·  view source on GitHub ↗

Return the common filling value of two masked arrays, if any. If ``a.fill_value == b.fill_value``, return the fill value, otherwise return None. Parameters ---------- a, b : MaskedArray The masked arrays for which to compare fill values. Returns -------

(a, b)

Source from the content-addressed store, hash-verified

553
554
555def common_fill_value(a, b):
556 """
557 Return the common filling value of two masked arrays, if any.
558
559 If ``a.fill_value == b.fill_value``, return the fill value,
560 otherwise return None.
561
562 Parameters
563 ----------
564 a, b : MaskedArray
565 The masked arrays for which to compare fill values.
566
567 Returns
568 -------
569 fill_value : scalar or None
570 The common fill value, or None.
571
572 Examples
573 --------
574 >>> x = np.ma.array([0, 1.], fill_value=3)
575 >>> y = np.ma.array([0, 1.], fill_value=3)
576 >>> np.ma.common_fill_value(x, y)
577 3.0
578
579 """
580 t1 = get_fill_value(a)
581 t2 = get_fill_value(b)
582 if t1 == t2:
583 return t1
584 return None
585
586
587def filled(a, fill_value=None):

Callers

nothing calls this directly

Calls 1

get_fill_valueFunction · 0.85

Tested by

no test coverage detected