vicky113
vicky113

Reputation: 351

Error with pulling data from Yahoo Finance

I am trying to pull data from Yahoo Finance via Pandas. I have used similar pulls before, but haven't faced any issue before this

import pandas as pd
import numpy as np
import datetime as dt
from dateutil import parser
from pandas_datareader import data
from dateutil.relativedelta import relativedelta

end_date=dt.datetime.today()

begdate = end_date + relativedelta(years=-10)

data1 = data.get_data_yahoo('^DJI',begdate,end_date,interval='m')

This is the error I am getting

RemoteDataError: Unable to read URL: http://ichart.finance.yahoo.com/table.csv

I am using Python 3.5

Upvotes: 2

Views: 2255

Answers (1)

Gustavo Bezerra
Gustavo Bezerra

Reputation: 11034

EDIT: This issue has been fixed as of v0.5.0 of pandas-reader. The fix below no longer applies.


As pointed out by others, the API endpoint has changed and a patch has been made but hasn't been merged to the master branch of pandas-datareader yet (as of 2017-05-21 6:19 UTC). The fix is at this branch by Rob Kimball (Issue | PR). For a temporary fix (until the patch is merged into master), try:

$ pip install git+https://github.com/rgkimball/pandas-datareader@fix-yahoo --upgrade

Or, in case you want to tweak the source code:

$ git clone https://github.com/rgkimball/pandas-datareader
$ cd pandas-datareader
$ git checkout fix-yahoo
$ pip install -e .

On Python:

import pandas_datareader as pdr
print(pdr.__version__)  # Make sure it is '0.4.1'.
pdr.get_data_yahoo('^DJI')

Upvotes: 4

Related Questions