I have a dataframe made up of all sorts of data. However, the two most important columns are a score column and week column:
df =
score week
6 21-06-2021
4 21-06-2021
9 21-06-2021
8 28-06-2021
2 28-06-2021
...
I want to be able to get the average score for each week in a new column, initially the dataframe started with an exact date column, but I converted it to round to the week instead. Ideally, the output would look like this:
df =
score week average
6 21-06-2021 6.33
4 21-06-2021 6.33
9 21-06-2021 6.33
8 28-06-2021 5
2 28-06-2021 5