Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

count unique elements in list python

from collections import Counter

words = ['a', 'b', 'c', 'a']

Counter(words).keys() # equals to list(set(words))
Counter(words).values() # counts the elements' frequency
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #count #unique #elements #list #python
ADD COMMENT
Topic
Name
5+1 =