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

Function _nan_mask

numpy/lib/nanfunctions.py:41–66  ·  view source on GitHub ↗

Parameters ---------- a : array-like Input array with at least 1 dimension. out : ndarray, optional Alternate output array in which to place the result. The default is ``None``; if provided, it must have the same shape as the expected output and will

(a, out=None)

Source from the content-addressed store, hash-verified

39
40
41def _nan_mask(a, out=None):
42 """
43 Parameters
44 ----------
45 a : array-like
46 Input array with at least 1 dimension.
47 out : ndarray, optional
48 Alternate output array in which to place the result. The default
49 is ``None``; if provided, it must have the same shape as the
50 expected output and will prevent the allocation of a new array.
51
52 Returns
53 -------
54 y : bool ndarray or True
55 A bool array where ``np.nan`` positions are marked with ``False``
56 and other positions are marked with ``True``. If the type of ``a``
57 is such that it can't possibly contain ``np.nan``, returns ``True``.
58 """
59 # we assume that a is an array for this private function
60
61 if a.dtype.kind not in 'fc':
62 return True
63
64 y = np.isnan(a, out=out)
65 y = np.invert(y, out=y)
66 return y
67
68def _replace_nan(a, val):
69 """

Callers 1

test__nan_maskFunction · 0.90

Calls

no outgoing calls

Tested by 1

test__nan_maskFunction · 0.72