summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorMarten van Kerkwijk <mhvk@astro.utoronto.ca>2021-09-14 13:37:59 -0400
committerMarten van Kerkwijk <mhvk@astro.utoronto.ca>2021-09-14 13:38:07 -0400
commit0dbc9ad1454aab5044ab0a14b9094db1a3c7c027 (patch)
tree58ca9e0c3e0dbe6012071fc1e45a51f806463911 /numpy/lib/function_base.py
parent6ba48721e22622403a60b7f9d3ec5cae308ba3a9 (diff)
downloadnumpy-0dbc9ad1454aab5044ab0a14b9094db1a3c7c027.tar.gz
MAINT: remove unused argument in private function
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index d875a00ae..e33d55056 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -3714,16 +3714,15 @@ def _median(a, axis=None, out=None, overwrite_input=False):
indexer[axis] = slice(index-1, index+1)
indexer = tuple(indexer)
+ # Use mean in both odd and even case to coerce data type,
+ # using out array if needed.
+ rout = mean(part[indexer], axis=axis, out=out)
# Check if the array contains any nan's
if np.issubdtype(a.dtype, np.inexact) and sz > 0:
- # warn and return nans like mean would
- rout = mean(part[indexer], axis=axis, out=out)
- return np.lib.utils._median_nancheck(part, rout, axis, out)
- else:
- # if there are no nans
- # Use mean in odd and even case to coerce data type
- # and check, use out array.
- return mean(part[indexer], axis=axis, out=out)
+ # If nans are possible, warn and replace by nans like mean would.
+ rout = np.lib.utils._median_nancheck(part, rout, axis)
+
+ return rout
def _percentile_dispatcher(a, q, axis=None, out=None, overwrite_input=None,