Reputation: 351
I am trying to download DJIA data from Yahoo Finance using Python.
from pandas_datareader import data as pdr
import fix_yahoo_finance as yf # Fix for downloading financial data from Yahoo, as the Pyhton Yahoo API has stopped working
yf.pdr_override()
djia = pdr.get_data_yahoo("^DJI", start="2017-10-20", end="2015-10-20")
But I get this error
Auto-overriding of pandas_datareader's get_data_yahoo() is deprecated and no longer available.
Any other way I can download DJIA data from Yahoo?
Upvotes: 0
Views: 2259
Reputation: 1553
import fix_yahoo_finance as yf
import datetime as dt
start = dt.datetime(2012,5,31)
end = dt.datetime(2018,5,31)
data = yf.download('DIA',start = start,end = end)
This code will work for dowloading DIA dat from yahoo finance.
You don't need to use pandas_datareader
Upvotes: 1