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

Function nanlast

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

Source from the content-addressed store, hash-verified

58
59
60def nanlast(values, axis, keepdims=False):
61 if isinstance(axis, tuple):
62 (axis,) = axis
63 axis = normalize_axis_index(axis, values.ndim)
64 rev = (slice(None),) * axis + (slice(None, None, -1),)
65 idx_last = -1 - np.argmax(~pd.isnull(values)[rev], axis=axis)
66 result = _select_along_axis(values, idx_last, axis)
67 if keepdims:
68 return np.expand_dims(result, axis=axis)
69 else:
70 return result
71
72
73def inverse_permutation(indices: np.ndarray, N: int | None = None) -> np.ndarray:

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…