无法从雅虎获取股票报价数据并显示超时错误(在Python中)
我尝试使用 pandas datareader 和 python 中的以下代码来获取股票价格:
Closeprice = pd.DataFrame()
tickers = ['AAPL','TSM','COKE','V','GE','JNJ','T','BABA']
for i in tickers:
tmp = pdr.DataReader(i, 'yahoo', '1/1/2010', dt.date.today())
Closeprice[i] = tmp['Adj Close']
但是。它显示超时错误:
ReadTimeout: HTTPSConnectionPool(host='finance.yahoo.com', port=443): Read timed out. (read timeout=30)
是因为雅虎方面的问题还是其他原因可能导致问题? 谢谢。
I try to obtain stock prices by using pandas datareader with the following code in python:
Closeprice = pd.DataFrame()
tickers = ['AAPL','TSM','COKE','V','GE','JNJ','T','BABA']
for i in tickers:
tmp = pdr.DataReader(i, 'yahoo', '1/1/2010', dt.date.today())
Closeprice[i] = tmp['Adj Close']
However. it shows timeout error:
ReadTimeout: HTTPSConnectionPool(host='finance.yahoo.com', port=443): Read timed out. (read timeout=30)
Is it because of the yahoo side of the problem or anything else might be causing the issue ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
调用“BABA”时出现错误,所以我将其删除。我也改变了代码。不过,我检查过你的代码也有效。
An error occurs when calling 'BABA', so I removed it. I also changed the code. However, I checked your code also works.