MCPcopy Create free account
hub / github.com/numpy/numpy / _nanmedian1d

Function _nanmedian1d

numpy/lib/nanfunctions.py:1058–1072  ·  view source on GitHub ↗

Private function for rank 1 arrays. Compute the median ignoring NaNs. See nanmedian for parameter usage

(arr1d, overwrite_input=False)

Source from the content-addressed store, hash-verified

1056
1057
1058def _nanmedian1d(arr1d, overwrite_input=False):
1059 """
1060 Private function for rank 1 arrays. Compute the median ignoring NaNs.
1061 See nanmedian for parameter usage
1062 """
1063 arr1d_parsed, overwrite_input = _remove_nan_1d(
1064 arr1d, overwrite_input=overwrite_input,
1065 )
1066
1067 if arr1d_parsed.size == 0:
1068 # Ensure that a nan-esque scalar of the appropriate type (and unit)
1069 # is returned for `timedelta64` and `complexfloating`
1070 return arr1d[-1]
1071
1072 return np.median(arr1d_parsed, overwrite_input=overwrite_input)
1073
1074
1075def _nanmedian(a, axis=None, out=None, overwrite_input=False):

Callers 1

_nanmedianFunction · 0.85

Calls 1

_remove_nan_1dFunction · 0.85

Tested by

no test coverage detected