I have a dataframe similar to the following:
site | date | risk
A 12/31 4
B 12/31 3
C 12/31 2
A 1/1 3
B 1/1 4
C 1/1 8
A 1/2 4
B 1/2 5
C 1/2 6
I want to calculate the average risk for each site after 12/31. I would want my output table to look like the following
site | risk
A 3.5
B 4.5
C 7
I also have more columns in my original dataframe, but I do not need them for this metric. Any suggestions?