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 %.
More Related Contents:
- How do I Pandas group-by to get sum?
- Get statistics for each group (such as count, mean, etc) using pandas GroupBy?
- How to groupby consecutive values in pandas DataFrame
- Python: get a frequency count based on two columns (variables) in pandas dataframe some row appers
- Pandas dataframe get first row of each group
- Pandas groupby multiple fields then diff
- How to access pandas groupby dataframe by key
- Pandas get frequency of item occurrences in a column as percentage [duplicate]
- Python Pandas How to assign groupby operation results back to columns in parent dataframe?
- How can I use cumsum within a group in Pandas?
- pandas – find first occurrence
- Add a sequential counter column on groups to a pandas dataframe
- Group dataframe and get sum AND count?
- Pandas groupby for zero values
- pandas divide row value by aggregated sum with a condition set by other cell
- Select row by max value in group in a pandas dataframe
- Pandas groupby with bin counts
- get first and last values in a groupby
- Pandas groupby and aggregation output should include all the original columns (including the ones not aggregated on)
- how to convert monthly data to quarterly in pandas
- Get the row corresponding to the max in pandas GroupBy [duplicate]
- How to get number of groups in a groupby object in pandas?
- Error: pandas hashtable keyerror
- Writing a pandas DataFrame to CSV file
- pandas: How do I split text in a column into multiple rows?
- Find row where values for column is maximal in a pandas DataFrame
- How to filter rows containing a string pattern from a Pandas dataframe [duplicate]
- python/pandas: convert month int to month name
- Convert pandas Series to DataFrame
- How to open and convert sqlite database to pandas dataframe