Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python, Pandas datareader and Yahoo Error RemoteDataError: Unable to read URL

I am trying to download historical data from Yahoo using Pandas datareader. This is the code that I normally use:

import pandas_datareader as pdr
df = pdr.get_data_yahoo('SPY')

However, I started receiving this error today: RemoteDataError: Unable to read URL: https://finance.yahoo.com/quote/SPY/history?period1=1467511200&period2=1625277599&interval=1d&frequency=1d&filter=history

Does anyone know how to solve it?

Thank you very much in advance!

like image 504
Martingale Avatar asked Jul 02 '21 19:07

Martingale


1 Answers

This has been answered here already. Since now requires headers, pandas and pandas-datareader must be updated. Other libraries working with pdr might give you issues until gets updated or you modify the part of the code which retreives data.

Have a nice day ;).

pip install --upgrade pandas
pip install --upgrade pandas-datareader
like image 161
Javier Castillo Guillén Avatar answered Sep 26 '22 18:09

Javier Castillo Guillén