def get_prophet_df(user_id):
prophet_df = pd.DataFrame.from_csv(PROPHET_PATH+'%d.csv'%user_id)
prophet_df.index = pd.to_datetime(prophet_df.ds)
prophet_df = prophet_df[get_prophet_columns()]
#predict 31 days
new_df = pd.DataFrame(index = prophet_df.index[31:-3])
for col in prophet_df.columns:
t_col = prophet_df[col].copy()
t_col.index += pd.Timedelta('3D')
#feature 3 days
#predict 33 days
for day in range(-3,31+3):
new_df[col+'#%d'%day] = t_col
t_col.index -= pd.Timedelta('1D')
return new_df.dropna()
评论列表
文章目录