I have a dataframe that looks like this:
id status year
1 yes 2014
3 no 2013
2 yes 2014
4 no 2014
The actual dataframe is very large with multiple ids and years. I am trying to make a new dataframe that has the percents of 'yes's and 'no's grouped by year.
I was thinking of grouping the dataframe by the year, which would then put the statuses per year in a list and then analyzing the counts of yes's and no's that way, but I was wondering whether there is a more pythonic way to do this?
I would like for the end dataframe to look like this:
year yes_count no_count ratio_yes_to_toal
2013 0 1 0%
2014 2 1 67%