MCPcopy Index your code
hub / github.com/numpy/numpy / _copyto

Function _copyto

numpy/lib/_nanfunctions_impl.py:115–141  ·  view source on GitHub ↗

Replace values in `a` with NaN where `mask` is True. This differs from copyto in that it will deal with the case where `a` is a numpy scalar. Parameters ---------- a : ndarray or numpy scalar Array or numpy scalar some of whose values are to be replaced by val.

(a, val, mask)

Source from the content-addressed store, hash-verified

113
114
115def _copyto(a, val, mask):
116 """
117 Replace values in `a` with NaN where `mask` is True. This differs from
118 copyto in that it will deal with the case where `a` is a numpy scalar.
119
120 Parameters
121 ----------
122 a : ndarray or numpy scalar
123 Array or numpy scalar some of whose values are to be replaced
124 by val.
125 val : numpy scalar
126 Value used a replacement.
127 mask : ndarray, scalar
128 Boolean array. Where True the corresponding element of `a` is
129 replaced by `val`. Broadcasts.
130
131 Returns
132 -------
133 res : ndarray, scalar
134 Array with elements replaced or scalar `val`.
135
136 """
137 if isinstance(a, np.ndarray):
138 np.copyto(a, val, where=mask, casting='unsafe')
139 else:
140 a = a.dtype.type(val)
141 return a
142
143
144def _remove_nan_1d(arr1d, second_arr1d=None, overwrite_input=False):

Callers 3

nanminFunction · 0.85
nanmaxFunction · 0.85
nanvarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…