What i want is including zero counts categories while generating frequencies for categorical variables
example:
col1 col2
a x
c y
a y
f z
what i want is to generate a frequency table with counts and percentages including zero counts categories
results
Counts Cercentage
a 2 50.0%
b 0 0.0%
c 1 25.0%
d 0 0.0%
e 1 25.0%
what i have done is generating the frequency table with counts and percentages but i need to include also the zero counts categories like b and d as illustrated above
here is what i have tried
pd.concat([df.col1.value_counts(dropna=False),
df.col1.value_counts(normalize=True,
dropna=False).mul(100).round(1).astype(str) + '%'],
axis=1,
keys=('Counts','Percentage'))
any help please