pricehistory.py 文件源码

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

项目:pyiem 作者: rheineke 项目源码 文件源码
def history_dates(mkt_id):
    url = _build_url('pricehistory/pricehistory_selectcontract.cfm')
    response = requests.get(url=url, params={'Market_ID': mkt_id})
    dfs = pd.read_html(response.text, index_col=0)

    # Expect a singleton list
    assert len(dfs) == 1

    df = dfs[0]

    mon_str = df.ix['Month:'][1]
    months = [dt.datetime.strptime(s[:3], '%b').month for s in mon_str.split()]
    year_str = df.ix['Year'][1]
    years = [int(s) for s in year_str.split()]

    return itertools.product(years, months)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号