Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python pandas datareader isn't working [closed]

Today, I was grabbing stock data using Python's pandas_datareader. Funny thing is it worked just several hours ago, but now I'm not able to grab stock data from yahoo-finance, but I can with google. I then upgraded pandas datareader in my command terminal, pip install pandas-datareader --upgrade. I then imported the upgraded package like usual, from pandas_datareader import data, wb.

And it still won't work, but it works for grabbing stock options. It should do acccording to this documentation for pandas datareader https://pypi.python.org/pypi/pandas-datareader/0.4.0

from pandas_datareader import Options

aapl = Options("AAPL" "yahoo")
aapl = aapl.get_all_data()

With google, grabbing stock data works.

import datetime
import pandas as pd
from pandas_datareader import data, wb

start = datetime.datetime(2016, 1, 1)
end = datetime.datetime(2017, 1, 1)

aapl = data.DataReader("AAPL", "google", start, end)

Yahoo-Finance doesn't work.

aapl = data.DataReader("AAPL", "yahoo", start, end)

This is so annoying! Can anyone help get stock data from Yahoo?

Here's the traceback:

aapl = data.DataReader("AAPL", "yahoo", start, end)
Traceback (most recent call last):

  File "", line 1, in 
    aapl = data.DataReader("AAPL", "yahoo", start, end)

  File "C:\Anaconda3\envs\p3\lib\site-packages\pandas_datareader\data.py", line 94, in DataReader
    session=session).read()

  File "C:\Anaconda3\envs\p3\lib\site-packages\pandas_datareader\yahoo\daily.py", line 77, in read
    df = super(YahooDailyReader, self).read()

  File "C:\Anaconda3\envs\p3\lib\site-packages\pandas_datareader\base.py", line 173, in read
    df = self._read_one_data(self.url, params=self._get_params(self.symbols))

  File "C:\Anaconda3\envs\p3\lib\site-packages\pandas_datareader\base.py", line 80, in _read_one_data
    out = self._read_url_as_StringIO(url, params=params)

  File "C:\Anaconda3\envs\p3\lib\site-packages\pandas_datareader\base.py", line 91, in _read_url_as_StringIO
    response = self._get_response(url, params=params)

  File "C:\Anaconda3\envs\p3\lib\site-packages\pandas_datareader\base.py", line 117, in _get_response
    raise RemoteDataError('Unable to read URL: {0}'.format(url))

RemoteDataError: Unable to read URL: http://ichart.finance.yahoo.com/table.csv
like image 534
MichaelRSF Avatar asked May 16 '17 22:05

MichaelRSF


1 Answers

As of the writing of this post, the website is down. Does not seem like an error on your end, as others have pointed out.

Reading the error message would give some indication to this, and a logical advancement from there would be to simply go to the URL in question: "http://ichart.finance.yahoo.com/table.csv" which pointed to being unavailable.

like image 187
Jeremy Avatar answered Oct 13 '22 23:10

Jeremy