preprocess.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:tianchi_power 作者: lvniqi 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号