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

Function _nanmedian_small

numpy/lib/_nanfunctions_impl.py:1100–1117  ·  view source on GitHub ↗

sort + indexing median, faster for small medians along multiple dimensions due to the high overhead of apply_along_axis see nanmedian for parameter usage

(a, axis=None, out=None, overwrite_input=False)

Source from the content-addressed store, hash-verified

1098
1099
1100def _nanmedian_small(a, axis=None, out=None, overwrite_input=False):
1101 """
1102 sort + indexing median, faster for small medians along multiple
1103 dimensions due to the high overhead of apply_along_axis
1104
1105 see nanmedian for parameter usage
1106 """
1107 a = np.ma.masked_array(a, np.isnan(a))
1108 m = np.ma.median(a, axis=axis, overwrite_input=overwrite_input)
1109 for i in range(np.count_nonzero(m.mask.ravel())):
1110 warnings.warn("All-NaN slice encountered", RuntimeWarning,
1111 stacklevel=5)
1112
1113 fill_value = np.timedelta64("NaT") if m.dtype.kind == "m" else np.nan
1114 if out is not None:
1115 out[...] = m.filled(fill_value)
1116 return out
1117 return m.filled(fill_value)
1118
1119
1120def _nanmedian_dispatcher(

Callers 1

_nanmedianFunction · 0.85

Calls 2

ravelMethod · 0.45
filledMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…