Python pandas datareader isn't working

Viewed 10903

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
1 Answers
Related