Add blank rows in time series forecasting
I want to add more rows in the time column with the future date for the time forecasting.
Answers
-
I have most commonly done this with a python recipe. I use python to generate the relevant rows, then stack them with the dataset to be forecast. Here's a little snippet of what I'm doing:
import dataiku
import pandas as pd, numpy as np
from dataiku import pandasutils as pdu
from datetime import datetime, timedelta, timezonehours_forward = 168
start_dt = datetime.now(timezone.utc) # start at the present time
start_dt = start_dt.replace(minute=0, second=0, microsecond=0) # truncate to hour.
end_dt = start_dt + timedelta(hours=hours_forward-1)r = pd.date_range(start_dt, end_dt, freq='H')
df = pd.DataFrame(r, columns=["ArrivedHour"]) # date column must match# Write recipe outputs
Synthesized_Dates = dataiku.Dataset("Synthesized_Dates")
Synthesized_Dates.write_with_schema(df)