Home > Back-end >  How to forecast future data based off 5 year average?
How to forecast future data based off 5 year average?

Time:11-14

I have 5 years of historical data at a daily granularity;

             Volume
2010-01-01   21
2010-01-02   38
2010-01-03   34
.
.
.
2015-12-31  48

There is a lot of seasonality in the data so I'm simply looking to do a forecast for the next 12 months using a 5 year average.

I can do this by;

df_fut = df.groupby(by=[df.index.month, df.index.day]).mean() 

Is there anyway to plot this so that the forecast is part of the current dataset?

CodePudding user response:

Assuming you have a column called date (of type datetime64) and a column called value (of type int or float):

avg_march_1sts = df[(df['date'].dt.month == 3) & (df['date'].dt.day == 1)]['Volume'].mean()
#                                  ^^^^^^^^^^ March             ^^^^^^^^ 1st
  • Related