Skip to content

Instantly share code, notes, and snippets.

@vishalsodani vishalsodani/freq_dict
Last active Dec 17, 2015

Embed
What would you like to do?
Count frequency of items using dictionary
frequency_count = dict()
some_data = ['a','b','v','c','l','c']
for item in some_data:
if item in frequency_count:
frequency_count[item] += 1
else:
frequency_count[item] = 1
print frequency_count
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.