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 %.
Related Contents:
- Get statistics for each group (such as count, mean, etc) using pandas GroupBy?
- Aggregation in Pandas
- Multiple aggregations of the same column using pandas GroupBy.agg()
- Groupby value counts on the dataframe pandas
- Converting a Pandas GroupBy output from Series to DataFrame
- Pandas groupby mean – into a dataframe?
- Python Pandas max value in a group as a new column
- How to loop over grouped Pandas dataframe?
- How to access pandas groupby dataframe by key
- Pandas Groupby and Sum Only One Column
- Group dataframe and get sum AND count?
- How to drop duplicates based on two or more subsets criteria in Pandas data-frame
- Python Pandas Group by date using datetime data
- Get frequency of item occurrences in a column as percentage [duplicate]
- Pandas – dataframe groupby – how to get sum of multiple columns
- How to get number of groups in a groupby object in pandas?
- How to filter Pandas dataframe using ‘in’ and ‘not in’ like in SQL
- How to drop rows of Pandas DataFrame whose value in a certain column is NaN
- Performant cartesian product (CROSS JOIN) with pandas
- Remove unwanted parts from strings in a column
- pandas: filter rows of DataFrame with operator chaining
- How to pivot a dataframe in Pandas? [duplicate]
- Convert the string 2.90K to 2900 or 5.2M to 5200000 in pandas dataframe
- How to take column-slices of dataframe in pandas
- Pandas DataFrame Groupby two columns and get counts
- How to add multiple columns to pandas dataframe in one assignment?
- Find column whose name contains a specific string
- Convert Pandas Dataframe to nested JSON
- How to filter rows containing a string pattern from a Pandas dataframe [duplicate]
- How do convert a pandas dataframe to XML?
- Making heatmap from pandas DataFrame
- Pandas, groupby and count
- Is there a simple way to change a column of yes/no to 1/0 in a Pandas dataframe?
- How to remove square bracket from pandas dataframe
- How do I filter a pandas DataFrame based on value counts?
- How to flatten a hierarchical index in columns
- Max and Min date in pandas groupby
- Pandas lookup from one of multiple columns, based on value
- Remove or replace spaces in column names
- Filling missing values using forward and backward fill in pandas dataframe (ffill and bfill)
- ‘DataFrame’ object has no attribute ‘sort’
- Pandas Replace NaN with blank/empty string
- How to show all columns’ names on a large pandas dataframe?
- Ranking order per group in Pandas
- Python/Pandas convert string to time only
- Pandas groupby for zero values
- AttributeError: ‘DataFrame’ object has no attribute ‘ix’
- Move column by name to front of table in pandas
- How to merge a Series and DataFrame
- pandas extract year from datetime: df[‘year’] = df[‘date’].year is not working