Calculate Proportion within one Column in Pandas

Hi friends,

i have a column with Values 1 and 0 in Pandas:

df['check'].value_counts()

0 65
1 13
Name: check, dtype: int64

I need the proportion in percentage of 1 compared to 0.
In this case: 20 %

How can i calculate it the best way?

Thanks,
Simo

value_counts(), if you check the documentation, has a normalize parameter that will give you the relative frequency you want.

1 Like