pythonyahoo-apipandas-datareader

problem with 1m interval in get_data_yahoo(pandas_datareader)


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')

Solution

  • 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")