Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

count proportion pandas

import pandas as pd

dogs = pd.DataFrame({
    'dog_name':['REX', 'WALTER', 'BLAZE', 'JASPER', 'TEDDY'], 
    'breed':['KOBE', 'OSCAR', 'OSCAR', 'KOBE', 'MAX']
})

print(dogs.value_counts(normalize=True))
 
PREVIOUS NEXT
Tagged: #count #proportion #pandas
ADD COMMENT
Topic
Name
3+7 =