gpt4 book ai didi

Python Pandas 数据阅读器不工作

转载 作者:太空狗 更新时间:2023-10-29 20:27:05 26 4
gpt4 key购买 nike

<分区>

今天,我正在使用 Python 的 pandas_datareader 抓取股票数据。有趣的是,它在几个小时前还有效,但现在我无法从 yahoo-finance 获取股票数据,但我可以使用 google。然后,我在命令终端 pip install pandas-datareader --upgrade 中升级了 pandas datareader。然后我像往常一样导入升级包,from pandas_datareader import data, wb

它仍然不起作用,但它可以用于获取股票期权。它应该根据 pandas datareader https://pypi.python.org/pypi/pandas-datareader/0.4.0 的文档进行操作

from pandas_datareader import Options

aapl = Options("AAPL" "yahoo")
aapl = aapl.get_all_data()

借助谷歌,抓取股票数据行之有效。

import datetime
import pandas as pd
from pandas_datareader import data, wb

start = datetime.datetime(2016, 1, 1)
end = datetime.datetime(2017, 1, 1)

aapl = data.DataReader("AAPL", "google", start, end)

Yahoo-Finance 不工作。

aapl = data.DataReader("AAPL", "yahoo", start, end)

这太烦人了!谁能帮忙从雅虎获取股票数据?

这是回溯:

aapl = data.DataReader("AAPL", "yahoo", start, end)Traceback (most recent call last):  File "", line 1, in     aapl = data.DataReader("AAPL", "yahoo", start, end)  File "C:\Anaconda3\envs\p3\lib\site-packages\pandas_datareader\data.py", line 94, in DataReader    session=session).read()  File "C:\Anaconda3\envs\p3\lib\site-packages\pandas_datareader\yahoo\daily.py", line 77, in read    df = super(YahooDailyReader, self).read()  File "C:\Anaconda3\envs\p3\lib\site-packages\pandas_datareader\base.py", line 173, in read    df = self._read_one_data(self.url, params=self._get_params(self.symbols))  File "C:\Anaconda3\envs\p3\lib\site-packages\pandas_datareader\base.py", line 80, in _read_one_data    out = self._read_url_as_StringIO(url, params=params)  File "C:\Anaconda3\envs\p3\lib\site-packages\pandas_datareader\base.py", line 91, in _read_url_as_StringIO    response = self._get_response(url, params=params)  File "C:\Anaconda3\envs\p3\lib\site-packages\pandas_datareader\base.py", line 117, in _get_response    raise RemoteDataError('Unable to read URL: {0}'.format(url))RemoteDataError: Unable to read URL: http://ichart.finance.yahoo.com/table.csv

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com