diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2010-05-16 08:31:03 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2010-05-16 08:31:03 +0000 |
commit | ccf308399107ec304b7e0d36692f9d929b6d3416 (patch) | |
tree | c5d44d55ff2841e699be38cf2bac6a088dff0946 /numpy/lib/function_base.py | |
parent | 7c92f3237ec81e42d490d3b5eff89725608a112d (diff) | |
download | numpy-ccf308399107ec304b7e0d36692f9d929b6d3416.tar.gz |
BUG: Correctly handle in-place output in percentile.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 7d825136c..5504a0f99 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -2964,9 +2964,15 @@ def percentile(a, q, axis=None, out=None, overwrite_input=False): # handle sequence of q's without calling sort multiple times def _compute_qth_percentile(sorted, q, axis, out): if not isscalar(q): - return [_compute_qth_percentile(sorted, qi, axis, out) - for qi in q] - q = q / 100.0 + p = [_compute_qth_percentile(sorted, qi, axis, None) + for qi in q] + + if out is not None: + out.flat = p + + return p + + q = q / 100.0 if (q < 0) or (q > 1): raise ValueError, "percentile must be either in the range [0,100]" |