gen_feat.py 文件源码

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

项目:JData 作者: Xls1994 项目源码 文件源码
def get_actions(start_date, end_date):
    """
    ????????????action??
    :param start_date:
    :param end_date:
    :return: actions: pd.Dataframe
    """
    dump_path = './cache/all_action_%s_%s.csv' % (start_date, end_date)
    if os.path.exists(dump_path):
        # actions = pickle.load(open(dump_path))
        actions = pd.read_csv(dump_path)
    else:
        action_1 = get_actions_1()
        action_2 = get_actions_2()
        action_3 = get_actions_3()
        actions = pd.concat([action_1, action_2, action_3])  # type: pd.DataFrame
        actions = actions[(actions.time >= start_date) & (actions.time < end_date)]
        # pickle.dump(actions, open(dump_path, 'w'))
        actions.to_csv(dump_path, index=False)
    print 'action combination finish...'
    return actions
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号