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,
*,
weights=None)
| 4063 | |
| 4064 | @array_function_dispatch(_percentile_dispatcher) |
| 4065 | def percentile(a, |
| 4066 | q, |
| 4067 | axis=None, |
| 4068 | out=None, |
| 4069 | overwrite_input=False, |
| 4070 | method="linear", |
| 4071 | keepdims=False, |
| 4072 | *, |
| 4073 | weights=None): |
| 4074 | """ |
| 4075 | Compute the q-th percentile of the data along the specified axis. |
| 4076 | |
| 4077 | Returns the q-th percentile(s) of the array elements. |
| 4078 | |
| 4079 | Parameters |
| 4080 | ---------- |
| 4081 | a : array_like of real numbers |
| 4082 | Input array or object that can be converted to an array. |
| 4083 | q : array_like of float |
| 4084 | Percentage or sequence of percentages for the percentiles to compute. |
| 4085 | Values must be between 0 and 100 inclusive. |
| 4086 | axis : {int, tuple of int, None}, optional |
| 4087 | Axis or axes along which the percentiles are computed. The |
| 4088 | default is to compute the percentile(s) along a flattened |
| 4089 | version of the array. |
| 4090 | out : ndarray, optional |
| 4091 | Alternative output array in which to place the result. It must |
| 4092 | have the same shape and buffer length as the expected output, |
| 4093 | but the type (of the output) will be cast if necessary. |
| 4094 | overwrite_input : bool, optional |
| 4095 | If True, then allow the input array `a` to be modified by intermediate |
| 4096 | calculations, to save memory. In this case, the contents of the input |
| 4097 | `a` after this function completes is undefined. |
| 4098 | method : str, optional |
| 4099 | This parameter specifies the method to use for estimating the |
| 4100 | percentile. There are many different methods, some unique to NumPy. |
| 4101 | See the notes for explanation. The options sorted by their R type |
| 4102 | as summarized in the H&F paper [1]_ are: |
| 4103 | |
| 4104 | 1. 'inverted_cdf' |
| 4105 | 2. 'averaged_inverted_cdf' |
| 4106 | 3. 'closest_observation' |
| 4107 | 4. 'interpolated_inverted_cdf' |
| 4108 | 5. 'hazen' |
| 4109 | 6. 'weibull' |
| 4110 | 7. 'linear' (default) |
| 4111 | 8. 'median_unbiased' |
| 4112 | 9. 'normal_unbiased' |
| 4113 | |
| 4114 | The first three methods are discontinuous. NumPy further defines the |
| 4115 | following discontinuous variations of the default 'linear' (7.) option: |
| 4116 | |
| 4117 | * 'lower' |
| 4118 | * 'higher', |
| 4119 | * 'midpoint' |
| 4120 | * 'nearest' |
| 4121 | |
| 4122 | .. versionchanged:: 1.22.0 |
searching dependent graphs…