네이버 주식 일별 시세 pandas read_html() 오류
---------------------------------------------------------------------------------------------------
import pandas as pd
# 네이버 금융 주식 일별시세(예, LG전자[066570])
url = "https://finance.naver.com/item/sise_day.nhn?code=066570"
df = pd.read_html(url)
---------------------------------------------------------------------------------------------------
=> 오류 발생 :
ValueError: No tables found
해결 방안 :
header에 {'User-agent': 'Mozilla/5.0'} 추가해서 넘겨줌
---------------------------------------------------------------------------------------------------
import pandas as pd
import requests
# 네이버 금융 주식 일별시세(예, LG전자[066570])
url = "https://finance.naver.com/item/sise_day.nhn?code=066570"
df = pd.read_html(requests.get(url, headers={'User-agent': 'Mozilla/5.0'}).text)
---------------------------------------------------------------------------------------------------
'개발 > Python' 카테고리의 다른 글
파이썬 가상 환경 만들기 (0) | 2021.06.01 |
---|---|
python code style check (pycodestyle) (0) | 2021.05.31 |
Pandas read_excel error : ValueError: Your version of xlrd is 2.0.1. In xlrd >= 2.0, only the xls format is supported. Install openpyxl instead. (0) | 2021.05.21 |
Anaconda3 spyder 5.0.0 install (0) | 2021.05.21 |
Anaconda3 Qt Designer execute (0) | 2021.05.20 |