【问题标题】:How to use GOOGLE as a data source for pandas data reader?如何使用 GOOGLE 作为 pandas 数据阅读器的数据源?
【发布时间】:2020-10-21 22:02:20
【问题描述】:

我想从谷歌来源获取数据,但遇到了一些错误

这是我的代码--

from pandas_datareader import data
import datetime
start=datetime.datetime(2020,1,1)
end=datetime.datetime(2020,6,30)
print(data.DataReader("TSLA",'google',start,end))

我遇到的错误:

NotImplementedError                       Traceback (most recent call last)
<ipython-input-25-a7c6d692c622> in <module>
      1 start=datetime.datetime(2020,1,1)
      2 end=datetime.datetime(2020,6,30)
----> 3 print(data.DataReader("TSLA",'google',start,end))

c:\users\rishi\appdata\local\programs\python\python38-32\lib\site-packages\pandas\util\_decorators.py in wrapper(*args, **kwargs)
    212                 else:
    213                     kwargs[new_arg_name] = new_arg_value
--> 214             return func(*args, **kwargs)
    215 
    216         return cast(F, wrapper)

c:\users\rishi\appdata\local\programs\python\python38-32\lib\site-packages\pandas_datareader\data.py in DataReader(name, data_source, start, end, retry_count, pause, session, api_key)
    374     if data_source not in expected_source:
    375         msg = "data_source=%r is not implemented" % data_source
--> 376         raise NotImplementedError(msg)
    377 
    378     if data_source == "yahoo":

NotImplementedError: data_source='google' is not implemented

【问题讨论】:

标签: python pandas pandas-datareader


【解决方案1】:

网络上的普遍看法是,“google”作为数据源已停止使用。

其他来源,如 yahoo 和 Alpha Vantage,也可以发挥作用。

【讨论】:

    【解决方案2】:

    写 yahoo 而不是 google 之类的:

    BAC = data.DataReader("BAC", 'yahoo', start, end)
    

    【讨论】:

      【解决方案3】:

      确保将数据源用作

      data_source == "yahoo"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-02-23
        • 1970-01-01
        • 2017-08-03
        • 1970-01-01
        相关资源
        最近更新 更多