Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

most frequent word in an array of strings python

words=['one','two','one','three','one']
word_counts=dict()
#after the loop the dictionary will have each word frequency
for word in words:
	try:
		word_counts[word]+=1
	except:
		word_counts[word]=1
 
PREVIOUS NEXT
Tagged: #frequent #word #array #strings #python
ADD COMMENT
Topic
Name
2+7 =