From 9dd212cee1c9ccab6013d52e776bcf6ef712a5e0 Mon Sep 17 00:00:00 2001 From: Jonathan Helmus Date: Mon, 16 Sep 2013 10:32:25 -0600 Subject: MAINT: changed 'closest' interpolation to 'nearest' --- numpy/lib/function_base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'numpy/lib/function_base.py') diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 1f6484959..9475c2edf 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -2780,14 +2780,14 @@ def percentile(a, q, interpolation='linear', axis=None, out=None, Input array or object that can be converted to an array. q : float in range of [0,100] (or sequence of floats) Percentile to compute which must be between 0 and 100 inclusive. - interpolation : {'linear', 'lower', 'higher', 'midpoint', 'closest'} + interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'} This optional parameter specifies the interpolation method to use, when the desired quantile lies between two data points `i` and `j`: * linear: `i + (j - i) * fraction`, where `fraction` is the fractional part of the index surrounded by `i` and `j`. * lower: `i`. * higher: `j`. - * closest: `i` or `j` whichever is closest. + * nearest: `i` or `j` whichever is nearest. * midpoint: (`i` + `j`) / 2. axis : int, optional Axis along which the percentiles are computed. The default (None) @@ -2890,13 +2890,13 @@ def percentile(a, q, interpolation='linear', axis=None, out=None, indices = ceil(indices).astype(intp) elif interpolation == 'midpoint': indices = floor(indices) + 0.5 - elif interpolation == 'closest': + elif interpolation == 'nearest': indices = around(indices).astype(intp) elif interpolation == 'linear': pass # keep index as fraction and interpolate else: raise ValueError("interpolation can only be 'linear', 'lower' " - "'higher', 'midpoint', or 'closest'") + "'higher', 'midpoint', or 'nearest'") if indices.dtype == intp: # take the points along axis ap.partition(indices, axis=axis) -- cgit v1.2.1