For a quick look at response times I don’t want to install numpy. The statistics module has been in the standard library for years and covers the basics.
import statistics
times_ms = [120, 130, 125, 900, 128]
print(statistics.mean(times_ms)) # 280.6
print(statistics.median(times_ms)) # 128
print(statistics.quantiles(times_ms, n=4)) # [122.5, 128.0, 515.0]
That example shows why I’d reach for the median first. One slow request of 900 ms drags the mean up to 280, while the median of 128 is what a typical visitor actually waited.
quantiles(data, n=4) returns the three cut points that split the data into quarters. Use n=100 and you get 99 percentiles, so quantiles(data, n=100)[94] is your p95. There’s also stdev, mode and fmean, which is a faster mean for floats.
The module is written in pure Python and favours correct results over speed. For a few thousand values that doesn’t matter at all. For millions of rows, numpy or pandas will be much faster. Also note that quantiles needs at least two data points and raises an error on fewer, so guard it if your list can be nearly empty.
Further reading: statistics module