diff options
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index d90c23bfe..fb5dd6fdd 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -4000,7 +4000,7 @@ def percentile(a, With 'i' being the floor and 'g' the fractional part of the result. .. math:: - i + g = (q - alpha) / ( n - alpha - beta + 1 ) + i + g = q * ( n - alpha - beta + 1 ) + alpha The different methods then work as follows @@ -4279,7 +4279,7 @@ def quantile(a, and alpha and beta are correction constants modifying i and j: .. math:: - i + g = (q - alpha) / ( n - alpha - beta + 1 ) + i + g = q * ( n - alpha - beta + 1 ) + alpha The different methods then work as follows @@ -5140,10 +5140,14 @@ def delete(arr, obj, axis=None): single_value = False _obj = obj obj = np.asarray(obj) + # `size == 0` to allow empty lists similar to indexing, but (as there) + # is really too generic: if obj.size == 0 and not isinstance(_obj, np.ndarray): obj = obj.astype(intp) - elif obj.size == 1 and not isinstance(_obj, bool): - obj = obj.astype(intp).reshape(()) + elif obj.size == 1 and obj.dtype.kind in "ui": + # For a size 1 integer array we can use the single-value path + # (most dtypes, except boolean, should just fail later). + obj = obj.item() single_value = True if single_value: |