I have a dataframe:
df = age is_A
1 True
1 False
2 True
3 True
3 True
3 True
3 False
I want to have the ratio of 'is_A' for each age
out = age ratio
1 0.5
2 1
3 0.75
What is the most efficient way for that?