Statistics Functions

statistics.mode()

Find a most frequently occurring hashable observation. Ties return the first encountered mode; use multimode for all tied values.

Formal Syntax & Structure

python syntaxpython
statistics.mode(data)

Parameters & Attributes

NameTypeDescription
dataiterable of hashable objectsObservations to count by value.

Return Value

object

A selected data item.

Working Example

Example Snippetpython
import statisticsprint(statistics.mode(['red', 'blue', 'red']))
Python Reference