Created
July 27, 2019 13:10
-
-
Save atriptoparadise/ec1ba607096b15bee0b11923d61941fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df_timeseries = pd.DataFrame(df.groupby(['Date'])['Amount'].sum()).sort_index(axis=0) | |
data = pd.DataFrame(df_timeseries.Amount) | |
data.columns = ["y"] | |
data = data.loc[data.index[:-1]] # drop data after 2019-06 since we want to predict next half year in 2019 | |
# Adding the lag of the target variable from 7 steps back up to 48 months ago | |
for i in range(7, 48): | |
data["lag_{}".format(i)] = data.y.shift(i) | |
data.tail() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment