diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-06-03 11:37:30 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-06-03 11:54:34 +0100 |
commit | ad1e3c118f378fd62883655a9a983dd0c682f968 (patch) | |
tree | 48cff66b5d36fa041fb64655acbf038af828810b /numpy/lib/function_base.py | |
parent | 090d46e76fbda7f7fc73751c221d0c58b9d889af (diff) | |
download | numpy-ad1e3c118f378fd62883655a9a983dd0c682f968.tar.gz |
MAINT: Combine similar branches
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 8ee6a54dd..b22fe5112 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -4005,8 +4005,9 @@ def _ureduce(a, func, **kwargs): # merge reduced axis a = a.reshape(a.shape[:nkeep] + (-1,)) kwargs['axis'] = -1 + keepdim = tuple(keepdim) else: - keepdim = [1] * a.ndim + keepdim = (1,) * a.ndim r = func(a, **kwargs) return r, keepdim @@ -4268,10 +4269,7 @@ def percentile(a, q, axis=None, out=None, overwrite_input=overwrite_input, interpolation=interpolation) if keepdims: - if q.ndim == 0: - return r.reshape(k) - else: - return r.reshape([len(q)] + k) + return r.reshape(q.shape + k) else: return r |