Pandas get frequency of item occurrences in a column as percentage [duplicate]

Use value_counts with normalize=True:

df['gender'].value_counts(normalize=True) * 100

The result is a fraction in range (0, 1]. We multiply by 100 here in order to get the %.

Leave a Comment