webreader.py 文件源码

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

项目:PyTrader 作者: didw 项目源码 文件源码
def get_financial_statements(code):
    url = "http://companyinfo.stock.naver.com/v1/company/ajax/cF1001.aspx?cmp_cd=%s&fin_typ=0&freq_typ=Y" % (code)
    html = requests.get(url).text

    html = html.replace('<th class="bg r01c02 endLine line-bottom"colspan="8">??</th>', "")
    html = html.replace("<span class='span-sub'>(IFRS??)</span>", "")
    html = html.replace("<span class='span-sub'>(IFRS??)</span>", "")
    html = html.replace('\t', '')
    html = html.replace('\n', '')
    html = html.replace('\r', '')

    html = html.replace('2011/12', '2011')
    html = html.replace('2012/03', '2011')
    html = html.replace('2012/12', '2012')
    html = html.replace('2013/03', '2012')
    html = html.replace('2013/12', '2013')
    html = html.replace('2014/03', '2013')
    html = html.replace('2014/12', '2014')
    html = html.replace('2015/03', '2014')
    html = html.replace('2015/12', '2015')

    df_list = pd.read_html(html, index_col='??????')
    df = df_list[0]
    return df
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号