MCPcopy
hub / github.com/pydata/xarray / nanfirst

Function nanfirst

xarray/core/nputils.py:48–57  ·  view source on GitHub ↗
(values, axis, keepdims=False)

Source from the content-addressed store, hash-verified

46
47
48def nanfirst(values, axis, keepdims=False):
49 if isinstance(axis, tuple):
50 (axis,) = axis
51 axis = normalize_axis_index(axis, values.ndim)
52 idx_first = np.argmax(~pd.isnull(values), axis=axis)
53 result = _select_along_axis(values, idx_first, axis)
54 if keepdims:
55 return np.expand_dims(result, axis=axis)
56 else:
57 return result
58
59
60def nanlast(values, axis, keepdims=False):

Callers

nothing calls this directly

Calls 4

_select_along_axisFunction · 0.85
argmaxMethod · 0.45
isnullMethod · 0.45
expand_dimsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…