diff options
author | Bharat123rox <bharatraghunthan9767@gmail.com> | 2019-05-12 22:10:24 +0530 |
---|---|---|
committer | Bharat123rox <bharatraghunthan9767@gmail.com> | 2019-05-12 22:10:24 +0530 |
commit | aa04be9e443e7c087c10989559af24e5ab6459f0 (patch) | |
tree | 8fa2a6b2b2b127a99c4aac5e94fb19be0d74642f /numpy/lib/function_base.py | |
parent | 4ebd08df74769ad0628a05e1d0654244008ab10b (diff) | |
parent | d2d589703d5ee743251fbc6ea045f28e1c5e9e71 (diff) | |
download | numpy-aa04be9e443e7c087c10989559af24e5ab6459f0.tar.gz |
Merge upstream branch 'master' of https://github.com/numpy/numpy into fix-genfromtxt
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 2e82fa075..7fa51d683 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1235,6 +1235,8 @@ def diff(a, n=1, axis=-1, prepend=np._NoValue, append=np._NoValue): a = asanyarray(a) nd = a.ndim + if nd == 0: + raise ValueError("diff requires input that is at least one dimensional") axis = normalize_axis_index(axis, nd) combined = [] @@ -3706,7 +3708,8 @@ def percentile(a, q, axis=None, out=None, plt.show() """ - q = np.true_divide(q, 100.0) # handles the asarray for us too + q = np.true_divide(q, 100) + q = asanyarray(q) # undo any decay that the ufunc performed (see gh-13105) if not _quantile_is_valid(q): raise ValueError("Percentiles must be in the range [0, 100]") return _quantile_unchecked( @@ -3924,7 +3927,7 @@ def _quantile_ureduce_func(a, q, axis=None, out=None, overwrite_input=False, indices_above = concatenate((indices_above, [-1])) weights_above = indices - indices_below - weights_below = 1.0 - weights_above + weights_below = 1 - weights_above weights_shape = [1, ] * ap.ndim weights_shape[axis] = len(indices) |