i want to sum two columns independently aggregated weekly(on Monday) sum by id and date. .
df = pd.DataFrame({'id':['x2', 'x2', 'x1', 'x1', 'x1'],
'date':['2021-01-03','2021-01-09', '2021-01-02', '2021-01-01', '2021-01-01'],
'distance_europe':[100, 100, 200, 200, 100],
'distance_USA': [0, 200, 100, 100, 3]})
expected output
2020-12-28 x2 100 0
2020-12-28 x1 500 203
2021-01-04 x2 100 200
update ---- My solution below works finely ---------
df = df.groupby('id').resample('W', on='date').sum().reset_index()
df['due_date'] = df.date - pd.Timedelta('6D')