[Python-ideas] Adding quantile to the statistics module

PLIQUE Guillaume guillaumeplique at gmail.com
Thu Mar 15 15:39:27 EDT 2018

Hello everyone,

Sorry if this subject has already been covered in the mailing list but I
could not find it.

My question is very simple: should the `quantile` function be added to
python `statistics` module.

I was very happy to learn the existence of this module in python3 only to
later be forced to install numpy to compute a .7 quantile which is even
more frustrating since the module actually provides an implementation of
the median.

I would therefore be willing to submit a PR to add the `quantile` function
to the module.

The function would have the following signature:

# data -> your sequence
# p -> the quantile, between 0 & 1
def quantile(data, p)

# example
quantile([1, 2, 3, 4, 5], 0.5)
>>> 3

This would also mean implementing very simply the `quantile_low` &
`quantile_high` function as their median counterparts in the module.

I am unclear, however, how to implement a hypothetic `quantile_grouped`.

What do you think?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180315/21c53ea3/attachment.html>

More information about the Python-ideas mailing list