Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to find number of categories in python

from collections import Counter
df = pd.DataFrame({'a':['apple','apple','banana','peach', 'banana', 'apple']})

print Counter(df['a'])
>> Counter({'apple': 3, 'banana': 2, 'peach': 1})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #find #number #categories #python
ADD COMMENT
Topic
Name
7+2 =