Skip to content

Instantly share code, notes, and snippets.

@bkaankuguoglu
Created November 25, 2021 14:58
Show Gist options
  • Save bkaankuguoglu/f103933348430f13907ef529a99d90af to your computer and use it in GitHub Desktop.
Save bkaankuguoglu/f103933348430f13907ef529a99d90af to your computer and use it in GitHub Desktop.
def get_datetime_index(df):
return (
pd.to_datetime(df.index[-1])
+ (pd.to_datetime(df.index[-1]) - pd.to_datetime(df.index[-2])),
pd.to_datetime(df.index[-1]) - pd.to_datetime(df.index[-2]),
)
start_date, freq = get_datetime_index(y_test)
index = pd.date_range(start=start_date, freq=freq, periods=100)
df_forecast = pd.DataFrame(index=index)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment