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)
| 1072 | |
| 1073 | |
| 1074 | def _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 | |
| 1100 | def _nanmedian_small(a, axis=None, out=None, overwrite_input=False): |
nothing calls this directly
no test coverage detected
searching dependent graphs…