• + 3 comments

    statistics.mode(data)

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

    If data is empty, or if there is not exactly one most common value, StatisticsError is raised.

    mode assumes discrete data, and returns a single value. This is the standard treatment of the mode as commonly taught in schools:

    >>> mode([1, 1, 2, 3, 3, 3, 3, 4])
    3
    

    Source