diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/lib/function_base.py | 2 | ||||
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index b42452b4a..7d825136c 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -2940,6 +2940,8 @@ def percentile(a, q, axis=None, out=None, overwrite_input=False): >>> assert not np.all(a==b) """ + a = np.asarray(a) + if q == 0: return a.min(axis=axis, out=out) elif q == 100: diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 10e3790ea..4949eba5d 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -967,5 +967,8 @@ def compare_results(res, desired): assert_array_equal(res[i], desired[i]) +def test_percentile_list(): + assert_equal(np.percentile([1,2,3], 0), 1) + if __name__ == "__main__": run_module_suite() |