I have a timestamped dataframe with two columns, containing sales of different products. What I want to do is create a plot of a certain products sale numbers in 10 minutes with 5 minute shifts, going back to 10 days back. I want the intervals shift like shown in the image. I have tried to use between function in a datetime shifting loop but it takes forever to fill up a list , shown in the code section, any faster solution?
example_apple = []
while interval_time <= end_time:
example_apple.append(df_thisyear.filter(df_thisyear.TIMESTAMP.between(start_time, interval_time)) \
.filter(df_thisyear.product == 'Apple').count())
start_time = start_time + timedelta(minutes=5)
interval_time = interval_time + timedelta(minutes=5)
