
marketCap 을 보면 '2.634988e+09' 이런식으로 출력되는데
단지 화면이 좁아서 나오는 현상일까요?

작성한 코드 및 에러 메세지
def add_company(code):
company = Ticker(code)
modules = 'summaryDetail assetProfile price financialData defaultKeyStatistics'
all_data = company.get_modules(modules)
name = all_data[code]['price']['shortName']
industry = all_data[code]['assetProfile']['industry']
marketCap= all_data[code]['price']['marketCap']
currentPrice= all_data[code]['financialData']['currentPrice']
business = all_data[code]['assetProfile']['longBusinessSummary']
targetPrice = all_data[code]['financialData']['targetMeanPrice']
per = all_data[code]['summaryDetail']['trailingPE']
eps = all_data[code]['defaultKeyStatistics']['trailingEps']
pbr = all_data[code]['defaultKeyStatistics']['priceToBook']
df_earnings = pd.DataFrame.from_dict(company.earnings[code]['financialsChart']['yearly'])
rev2021 = df_earnings.iloc[-2,1]
rev2020 = df_earnings.iloc[-3,1]
rev2019 = df_earnings.iloc[-4,1]
ear2021 = df_earnings.iloc[-2,2]
ear2020 = df_earnings.iloc[-3,2]
ear2019 = df_earnings.iloc[-4,2]
doc = {
'code':code,
'name':name,
'industry':industry,
'business':business,
'marketCap':marketCap/1000,
'currentPrice':currentPrice,
'targetPrice':targetPrice,
'per':per,
'eps':eps,
'pbr':pbr,
'rev2021':rev2021/1000,
'rev2020':rev2020/1000,
'rev2019':rev2019/1000,
'ear2021':ear2021/1000,
'ear2020':ear2020/1000,
'ear2019':ear2019/1000,
}
return doc
df = pd.DataFrame()
codes = ['AAPL','ABNB','BIDU','FB','GOOG','MSFT','TSLA','PYPL','NFLX','NVDA']
for code in codes:
try:
row = add_company(code)
df = df.append(row, ignore_index = True)
except:
print(f'error - {code}')
df
Command+A) 단축키로 코드를 한 번에 선택할 수 있어요!
