Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Count frequency of items in a list
from collections import Counter
cnt = Counter()
some_data = ['a','b','v','c','l','c']
for item in some_data:
cnt[item] += 1
print cnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.