Python statistics.multimode() Function



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
Advertisements
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy