preprocess.py 文件源码

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

项目:Book_DeepLearning_Practice 作者: wac81 项目源码 文件源码
def get_am_pm_price(code, date):
    '''
    :param code: ????
    :param date: ??????
    :return: ??????????????10?,???2:30???
    '''
    if type(code) is not str or type(date) is not str:
        code = str(code)
        date = str(date)
    import tushare as ts
    df = ts.get_tick_data(code, date)
    dtime = df.set_index('time')
    price = dtime['price']
    if price.shape == (0,):
        print code, "can't get ", date, "am_pm data!"
        return float('nan'), float('nan')
    else:
        return price[-1], price[len(df.time)/4]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号