Compute the q-th percentile of the data along the specified axis. Returns the q-th percentile(s) of the array elements. Parameters ---------- a : array_like of real numbers Input array or object that can be converted to an array. q : array_like of float Per
(a,
q,
axis=None,
out=None,
overwrite_input=False,
method="linear",
keepdims=False,
*,
interpolation=None)
| 3991 | |
| 3992 | @array_function_dispatch(_percentile_dispatcher) |
| 3993 | def percentile(a, |
| 3994 | q, |
| 3995 | axis=None, |
| 3996 | out=None, |
| 3997 | overwrite_input=False, |
| 3998 | method="linear", |
| 3999 | keepdims=False, |
| 4000 | *, |
| 4001 | interpolation=None): |
| 4002 | """ |
| 4003 | Compute the q-th percentile of the data along the specified axis. |
| 4004 | |
| 4005 | Returns the q-th percentile(s) of the array elements. |
| 4006 | |
| 4007 | Parameters |
| 4008 | ---------- |
| 4009 | a : array_like of real numbers |
| 4010 | Input array or object that can be converted to an array. |
| 4011 | q : array_like of float |
| 4012 | Percentage or sequence of percentages for the percentiles to compute. |
| 4013 | Values must be between 0 and 100 inclusive. |
| 4014 | axis : {int, tuple of int, None}, optional |
| 4015 | Axis or axes along which the percentiles are computed. The |
| 4016 | default is to compute the percentile(s) along a flattened |
| 4017 | version of the array. |
| 4018 | |
| 4019 | .. versionchanged:: 1.9.0 |
| 4020 | A tuple of axes is supported |
| 4021 | out : ndarray, optional |
| 4022 | Alternative output array in which to place the result. It must |
| 4023 | have the same shape and buffer length as the expected output, |
| 4024 | but the type (of the output) will be cast if necessary. |
| 4025 | overwrite_input : bool, optional |
| 4026 | If True, then allow the input array `a` to be modified by intermediate |
| 4027 | calculations, to save memory. In this case, the contents of the input |
| 4028 | `a` after this function completes is undefined. |
| 4029 | method : str, optional |
| 4030 | This parameter specifies the method to use for estimating the |
| 4031 | percentile. There are many different methods, some unique to NumPy. |
| 4032 | See the notes for explanation. The options sorted by their R type |
| 4033 | as summarized in the H&F paper [1]_ are: |
| 4034 | |
| 4035 | 1. 'inverted_cdf' |
| 4036 | 2. 'averaged_inverted_cdf' |
| 4037 | 3. 'closest_observation' |
| 4038 | 4. 'interpolated_inverted_cdf' |
| 4039 | 5. 'hazen' |
| 4040 | 6. 'weibull' |
| 4041 | 7. 'linear' (default) |
| 4042 | 8. 'median_unbiased' |
| 4043 | 9. 'normal_unbiased' |
| 4044 | |
| 4045 | The first three methods are discontinuous. NumPy further defines the |
| 4046 | following discontinuous variations of the default 'linear' (7.) option: |
| 4047 | |
| 4048 | * 'lower' |
| 4049 | * 'higher', |
| 4050 | * 'midpoint' |
nothing calls this directly
no test coverage detected