Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python count the frequency of words in a list

from collections import Counter
list1=['apple','egg','apple','banana','egg','apple']
counts = Counter(list1)

print(counts)
# Counter({'apple': 3, 'egg': 2, 'banana': 1})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #count #frequency #words #list
ADD COMMENT
Topic
Name
5+2 =