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

Function _nanmedian

numpy/lib/_nanfunctions_impl.py:1074–1097  ·  view source on GitHub ↗

Private function that doesn't support extended axis or keepdims. These methods are extended to this function using _ureduce See nanmedian for parameter usage

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

Source from the content-addressed store, hash-verified

1072
1073
1074def _nanmedian(a, axis=None, out=None, overwrite_input=False):
1075 """
1076 Private function that doesn't support extended axis or keepdims.
1077 These methods are extended to this function using _ureduce
1078 See nanmedian for parameter usage
1079
1080 """
1081 if axis is None or a.ndim == 1:
1082 part = a.ravel()
1083 if out is None:
1084 return _nanmedian1d(part, overwrite_input)
1085 else:
1086 out[...] = _nanmedian1d(part, overwrite_input)
1087 return out
1088 else:
1089 # for small medians use sort + indexing which is still faster than
1090 # apply_along_axis
1091 # benchmarked with shuffled (50, 50, x) containing a few NaN
1092 if a.shape[axis] < 600:
1093 return _nanmedian_small(a, axis, out, overwrite_input)
1094 result = np.apply_along_axis(_nanmedian1d, axis, a, overwrite_input)
1095 if out is not None:
1096 out[...] = result
1097 return result
1098
1099
1100def _nanmedian_small(a, axis=None, out=None, overwrite_input=False):

Callers

nothing calls this directly

Calls 3

_nanmedian1dFunction · 0.85
_nanmedian_smallFunction · 0.85
ravelMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…