I want to get a percentage of a particular value in a df column. Say I have a df with (col1, col2 , col3, gender) gender column has values of M or F. I want to get the perc
Use value_counts with normalize=True:
value_counts
normalize=True
df['gender'].value_counts(normalize=True) * 100