Percentile
A percentile describes a position in an ordered distribution. It can communicate a slow-tail experience that a mean hides.
Understand the idea
Several interpolation conventions exist, especially for small samples. State the method when results must be reproduced across tools. This example uses NumPy's linear method, so its middle percentile lies halfway between the two central values. Percentiles of subgroup summaries cannot generally be averaged into a correct overall percentile.
Where to try it
Open this example in the NumPy playground. It loads the same Python code with NumPy available when you choose Run. The first runtime/package download may take a moment. Nothing executes merely because the example was loaded.
A worked example
import numpy as np
durations = [10, 20, 30, 40]
print(np.percentile(durations, [25, 50, 75], method="linear"))
Read the result
The quartile values are 17.5, 25.0, and 32.5 under this interpolation rule.
Try one change
Compare the result with another interpolation method and explain why a small-sample report needs its method documented.
For package options, see the scikit-learn documentation.