簡體   English   中英

pandas_datareader 中的 NotImplementedError

[英]NotImplementedError in pandas_datareader

我試圖從 Yahoo Finance 讀取數據,但出現錯誤。

這是我的代碼:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pandas_datareader as data

這是我收到錯誤的單元格:

start = '2012-01-01' 
end = '2021-12-31'

df = data.DataReader('AAPL', start, end)

這是我遇到的錯誤消息:

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-12-d022432a6feb> in <module>()
      2 end = '2021-12-31'
      3 
----> 4 df = data.DataReader('AAPL', start, end)

1 frames
/usr/local/lib/python3.7/dist-packages/pandas_datareader/data.py in DataReader(name, data_source, start, end, retry_count, pause, session, api_key)
    371     if data_source not in expected_source:
    372         msg = "data_source=%r is not implemented" % data_source
--> 373         raise NotImplementedError(msg)
    374 
    375     if data_source == "yahoo":

NotImplementedError: data_source='2012-01-01' is not implemented

任何幫助將不勝感激。 謝謝:)

df = data.DataReader('AAPL', 'yahoo', start = '2012-01-01', end = '2021-12-31')

Output

                  High         Low  ...       Volume   Adj Close
Date                                ...                         
2012-01-03   14.732143   14.607143  ...  302220800.0   12.575914
2012-01-04   14.810000   14.617143  ...  260022000.0   12.643499
2012-01-05   14.948214   14.738214  ...  271269600.0   12.783866
2012-01-06   15.098214   14.972143  ...  318292800.0   12.917505
2012-01-09   15.276786   15.048214  ...  394024400.0   12.897019

未指定數據源:'yahoo'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM