summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorabel <aoun@cerfacs.fr>2021-10-21 09:59:53 +0200
committerSebastian Berg <sebastian@sipsolutions.net>2021-11-04 14:50:27 -0500
commit8413b5abf27221fb2bea070871c7cd8f8da5519c (patch)
tree6ed671c13fb7cde5e9713f3d72ea8e0061d247ba /numpy
parent2a5422da7cb6759d75477738cc192fee3ca2a19c (diff)
downloadnumpy-8413b5abf27221fb2bea070871c7cd8f8da5519c.tar.gz
MAINT: Clean following PR comments
Diffstat (limited to 'numpy')
-rw-r--r--numpy/lib/function_base.py9
-rw-r--r--numpy/lib/nanfunctions.py15
2 files changed, 7 insertions, 17 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index a16781f53..c33626df4 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -3915,7 +3915,7 @@ def percentile(a,
* (H&F 8): 'median_unbiased'
* (H&F 9): 'normal_unbiased'
- .. versionadded;: 1.22.0
+ .. versionchanged:: 1.22.0
keepdims : bool, optional
If this is set to True, the axes which are reduced are left in
@@ -4439,10 +4439,7 @@ def _lerp(a, b, t, out=None):
diff_b_a = subtract(b, a)
# asanyarray is a stop-gap until gh-13105
lerp_interpolation = asanyarray(add(a, diff_b_a * t, out=out))
- lerp_interpolation = subtract(b,
- diff_b_a * (1 - t),
- out=lerp_interpolation,
- where=t >= 0.5)
+ subtract(b, diff_b_a * (1 - t), out=lerp_interpolation, where=t >= 0.5)
if lerp_interpolation.ndim == 0 and out is None:
lerp_interpolation = lerp_interpolation[()] # unpack 0d arrays
return lerp_interpolation
@@ -4580,7 +4577,7 @@ def _quantile(
except KeyError:
raise ValueError(
f"{interpolation!r} is not a valid interpolation. Use one of: "
- f"{_QuantileInterpolation.keys()}")
+ f"{_QuantileInterpolation.keys()}") from None
virtual_indexes = interpolation["get_virtual_index"](values_count,
quantiles)
virtual_indexes = np.asanyarray(virtual_indexes)
diff --git a/numpy/lib/nanfunctions.py b/numpy/lib/nanfunctions.py
index 710242d59..c3333a83a 100644
--- a/numpy/lib/nanfunctions.py
+++ b/numpy/lib/nanfunctions.py
@@ -1532,7 +1532,7 @@ def nanquantile(
* (H&F 8): 'median_unbiased'
* (H&F 9): 'normal_unbiased'
- .. versionadded;: 1.22.0
+ .. versionchanged:: 1.22.0
keepdims : bool, optional
If this is set to True, the axes which are reduced are left in
@@ -1729,12 +1729,8 @@ def _nanquantile_unchecked(
return r
-def _nanquantile_ureduce_func(a,
- q,
- axis=None,
- out=None,
- overwrite_input=False,
- interpolation= "linear"):
+def _nanquantile_ureduce_func(a, q, axis=None, out=None, overwrite_input=False,
+ interpolation="linear"):
"""
Private function that doesn't support extended axis or keepdims.
These methods are extended to this function using _ureduce
@@ -1757,10 +1753,7 @@ def _nanquantile_ureduce_func(a,
return result
-def _nanquantile_1d(arr1d,
- q,
- overwrite_input=False,
- interpolation= "linear"):
+def _nanquantile_1d(arr1d, q, overwrite_input=False, interpolation="linear"):
"""
Private function for rank 1 arrays. Compute quantile ignoring NaNs.
See nanpercentile for parameter usage