Last active
May 26, 2019 10:57
-
-
Save Linus-Albertus/65b81c8c473559991fd9dbd27caeb5b8 to your computer and use it in GitHub Desktop.
[most frequent elements] Take a list of elements and return their frequency #python #collections #freqs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
count = Counter(a_list_of_repeated_elements) | |
print(count.most_common(3)) # Show the 3 more frequent elements of a list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment