I need to group the data by websites and get the average of views for the specific range of dates. My data looks like this:
date website amount_views
1/1/2021 a 23
1/2/2021 a 17
1/3/2021 a 10
1/4/2021 a 25
1/5/2021 a 2
1/1/2021 b 12
1/2/2021 b 7
1/3/2021 b 5
1/4/2021 b 17
1/5/2021 b 2
So I need to see what is the average for a and b websites for two ranges of date (1/1/2021 - 1/3/2021 (pre) AND 1/3/2021 - 1/5/2021 (post)) The desired output is:
date website avg_amount_views
pre a 31.5
post a 35.6
pre b 15.5
post b 22.6