作者iuz (iuz)
看板Python
标题[问题] 上网抓取雅虎财经的资料
时间Thu Dec 7 20:40:53 2017
我按照书上练习,抓取中美晶今年10月1日到12月7日的股票资讯,不知道为什麽出现错误讯息。
raise RemoteDataError('Unable to read URL: {0}'.format(url))
RemoteDataError: Unable to read URL:
https://query1.finance.yahoo.com/v7/finance/download/5483?period1=1506787200&period2=1512662399&interval=1d&events=history&crumb=PvaymnVJl%5Cu002Ft
=====底下是书上练习码,我只有改股票代号=======
import pandas as pd
import pandas_datareader.data as web
import datetime
start = datetime.datetime(2017,10,1)
end = datetime.datetime(2017,12,7)
df = web.DataReader('5483.tw','yahoo',start,end)
writer=pd.ExcelWriter('./file/stock5483.xlsx')
df.to_excel(writer,'Sheet1')
writer.save()
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 1.164.24.79
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1512650455.A.C67.html
1F:推 hl4: 5483.two 12/07 21:37
※ 编辑: iuz (1.164.24.79), 12/07/2017 22:57:18
2F:→ iuz: 成功了!谢谢! 12/07 23:54