September 2026
1051 pages
35h 4m
English
The statistics module of the standard library contains several useful functions that perform simple statistical calculations.
The functions contained in the statistics module usually operate on a sample, an iterable object that iterates through numeric values. An example of a sample consisting of 10 floats could look as follows:
>>> data = [1.0, 2.0, 2.0, 5.7, 7.0, 1.1, 4.0, 2.0, 6.5, 1.5]
Basically, a sample for use with the statistics module can contain integers, floats, and the decimal and fraction data types from the decimal and fractions modules.
A sample should always consist of instances of a single data type; otherwise, the functions implemented in statistics might show undefined behavior. ...
Read now
Unlock full access