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
评论列表
文章目录