← Winnitude! Search  ·  Reader Mode (121 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
WWW.TUTORIALSPOINT.COM · 250 LINKS

Python statistics.multimode() Function

Selected Reading

Python statistics.multimode() Function


Previous Quiz Next

The Python statistics.multimode function returns the list of most frequently occurring values in the given dataset.

This function will return more than one result if there are multiple modes or an empty list.

Syntax

Following is the basic syntax for the statistics.multimode() function −

statistics.multimode(data)

Parameters

Here, the data values can be used as any sequence, list or iterator.

Return Value

This function returns the most frequent values from the dataset.

Example 1

In the below example we are calculating the most common values from the dataset using statistics.mode() function.

import statistics
x = statistics.multimode('ddddddqqffffggggg')
print(x)

Output

The output obtained is as follows −

['d']

Example 2

Here, we are calculating the most frequent values from the dataset using statistics.multimode() function.

import statistics
x = statistics.multimode('111113334488888')
print(x)

Output

This produces the following result −

['1', '8']

Example 3

Now, we are calculating the multimode from the given dataset using statistics.multimode function.

import statistics
x = statistics.multimode('aaaa22fffhhhdddd7777')
print(x)

Output

The result is produced as follows −

['a', 'd', '7']
python_modules.htm Previous Quiz Next Advertisements