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.
SyntaxFollowing 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 ValueThis function returns the most frequent values from the dataset.
Example 1In 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4