Using Python & Pandas I'm trying to create a count of occurrences for each location utilizing a 7 day window. For simplicity, I'm looking at the first 2 weeks of June 2020,
And I'm trying to aggregate these rows into a count of occurances in a 7 day window, returning results like
Right now, I have the following code,
#Ensure it's a date format and then create the index to be date
df['date'] = pd.to_datetime(df['date'], format='%Y-%m-%d')
df = df.set_index('date', drop = True)
#Group the location IDs and utilizing the index (date), create a rolling count for a 7 day window
week_windows = df.groupby('location_id').rolling('7D').count()
What I'm receiving (and don't want) seems to be an indexing of the count,