I have daily covid data that I would like to roll up to weekly. The problem is that I want my weeks to go from Sunday to Saturday, but the default is Mon to Sun. I tried to use loffset, but it's only changing the dates not my data, plus it's adding a date that does not exist in the dataset.
Code:
logic = {'iso_code' : 'first',
'new_cases' : 'sum',
'new_deaths' : 'sum',
'icu_patients' : 'sum',
'hosp_patients' : 'sum',
'people_vaccinated': 'sum'} #it's possible to have 'first', 'max','last', etc
offset = pd.offsets.DateOffset(-1)
df_covid_weekly = df_covid_file.resample('W', on='date', label = 'right', loffset=offset).apply(logic).reset_index()