Skip to content

Instantly share code, notes, and snippets.

@vishalsodani
Created May 5, 2013 13:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vishalsodani/5520864 to your computer and use it in GitHub Desktop.
Save vishalsodani/5520864 to your computer and use it in GitHub Desktop.
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