percentile
percentile(a, q, axis=None, *, validate=True)Return linear-interpolation percentiles with NaN propagation.
Parameters
a : array_like-
Input data. Supported numeric inputs are normalized to a contiguous kernel array when
validate=True. Computed reducers promote integer and bool inputs tofloat64; exact selection reducers keep integer and bool dtypes where the selected value can be returned exactly. Complex and object arrays are not supported. q : scalar or array_like-
Percentile or percentiles in
[0, 100]. A scalarqreturns a scalar foraxis=Noneor one output array for axis reductions. Multipleqvalues are returned on a leading output axis. axis : None, 0, -1, or int = None-
Axis to reduce.
Nonereduces the whole array.0reduces strided reducing-axis slices into the remaining shape.-1andndim - 1reduce contiguous slices. Other axes raiseNotImplementedError. validate : bool = True-
If
True, check dtype, dimensionality, contiguity, and axis validity before entering the Rust kernel. IfFalse, the caller must provide a contiguous supported kernel dtype (float32,float64, bool, or a NumPy integer dtype).validate=Falseskips dtype promotion: integer and bool arrays are reduced directly, while complex and object arrays remain unsupported.
Returns
out : float or ndarray-
Interpolated percentile result. Multiple
qvalues are returned on a leading axis, matching NumPy’s output layout.
Notes
Plain reducers include every value, so NaN and inf propagate with IEEE / NumPy-like semantics. This is the fastest path for known-clean finite data.