Cant work S&P 500 - Python Programming for Finance p.6

by: JasonKim, 7 years ago


I try to S&P 500 - Python Programming for Finance p.6 code
but it keeps error like this

Traceback (most recent call last):
  File "/Users/jason/PycharmProjects/yahoofinance/ATPQ6.py", line 50, in <module>
    get_data_from_yahoo()
  File "/Users/jason/PycharmProjects/yahoofinance/ATPQ6.py", line 44, in get_data_from_yahoo
    df = web.DataReader(ticker, "yahoo", start, end)
  File "/Users/jason/anaconda/lib/python3.6/site-packages/pandas_datareader/data.py", line 116, in DataReader
    session=session).read()
  File "/Users/jason/anaconda/lib/python3.6/site-packages/pandas_datareader/yahoo/daily.py", line 76, in read
    df = super(YahooDailyReader, self).read()
  File "/Users/jason/anaconda/lib/python3.6/site-packages/pandas_datareader/base.py", line 155, in read
    df = self._read_one_data(self.url, params=self._get_params(self.symbols))
  File "/Users/jason/anaconda/lib/python3.6/site-packages/pandas_datareader/base.py", line 74, in _read_one_data
    out = self._read_url_as_StringIO(url, params=params)
  File "/Users/jason/anaconda/lib/python3.6/site-packages/pandas_datareader/base.py", line 85, in _read_url_as_StringIO
    response = self._get_response(url, params=params)
  File "/Users/jason/anaconda/lib/python3.6/site-packages/pandas_datareader/base.py", line 120, in _get_response
    raise RemoteDataError('Unable to read URL: {0}'.format(url))
pandas_datareader._utils.RemoteDataError: Unable to read URL: http://ichart.finance.yahoo.com/table.csv?s=BRK.B&a=0&b=1&c=2000&d=11&e=31&f=2016&g=d&ignore=.csv

how can I fix this?



You must be logged in to post. Please login or register an account.



There seems to be a problem with your URL.  Look into how you're constructing the URL and make sure that is valid.  I haven't watched these tutorials yet, so I can't see the code.  But that URL at the bottom of the error doesn't lead anywhere.

-mabryp 7 years ago

You must be logged in to post. Please login or register an account.

I'm new to this and only guessing, but the url should be good as it comes from pandas_datareader, check if the parameters going in have a typo. I had typo's I couldn't find initially and ended copying code from the site, so you know this code is good so if you still get an error it could be a package problem, I haven't mastered reading the error messages yet.

-jasonrobert 7 years ago

You must be logged in to post. Please login or register an account.