problem with 1m interval in get_data_yahoo(pandas_datareader)

回眸只為那壹抹淺笑 提交于 2020-12-29 08:42:30

问题


I wrote

from pandas_datareader import data as pdr
import yfinance as yf
data = pdr.get_data_yahoo("AAPL", start='2020-04-12', end='2020-04-13', interval="m")

And I got a error

KeyError 'Date'

I heard people saying Yahoo finance API is down but I still can get the following code working correctly

data = pdr.get_data_yahoo("AAPL", start='2020-04-12', end='2020-04-13')

回答1:


pandas_datareader interval="m" means 1 month you need yfinance.

  1. pip download yfinance
  2. import yfinance
  3. a = yfinance.download(ticker="your symbol",period="5d",interval="1m")


来源:https://stackoverflow.com/questions/61810596/problem-with-1m-interval-in-get-data-yahoopandas-datareader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!