ID EN
Statistics

mode

Python 3.11

Return the single most common data point from discrete or nominal data. The mode (when it exists) is the most typical value and serves as a measure of central location.

Syntax

PYTHON
statistics.mode(data)

Examples

Example 1
PYTHON
>>> mode([1, 1, 2, 3, 3, 3, 3, 4])
3
Example 2
PYTHON
>>> mode(["red", "blue", "blue", "red", "green", "red", "red"])
'red'

See Also

StatisticsError StatisticsError