Statistics Functions

statistics.quantiles()

Estimate n-1 cut points using exclusive or inclusive interpolation. In Python 3.13 a single observation is accepted; empty data is invalid.

Formal Syntax & Structure

python syntaxpython
statistics.quantiles(data, *, n=4, method='exclusive')

Parameters & Attributes

NameTypeDescription
dataiterable of numbersObservations used by the statistic.
nintNumber of intervals (at least one).
methodstrChoose exclusive or inclusive interpolation.

Return Value

list[number]

List of interpolated numeric cut points.

Working Example

Example Snippetpython
import statisticsprint(statistics.quantiles([0, 10, 20, 30, 40], n=4, method='inclusive'))
Python Reference