from collections import Counter
result = Counter(mylist) # # Counter({'d': 5, 'b': 3, 'a': 2, 'c': 1})
Frequency of Elements in a List
Shortcut: list.frequency
0 Comments
Add Comment
Log in to add a comment
from collections import Counter
result = Counter(mylist) # # Counter({'d': 5, 'b': 3, 'a': 2, 'c': 1})
Frequency of Elements in a List
Shortcut: list.frequency
Log in to add a comment