Reputation: 523
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!
Upvotes: 20
Views: 34421
Reputation: 23592
If you are using Colab, run:
!pip install --upgrade pandas-datareader
...
Installing collected packages: pandas-datareader
Attempting uninstall: pandas-datareader
Found existing installation: pandas-datareader 0.9.0
Uninstalling pandas-datareader-0.9.0:
Successfully uninstalled pandas-datareader-0.9.0
Successfully installed pandas-datareader-0.10.0
WARNING: The following packages were previously imported in this runtime:
[pandas_datareader]
You must restart the runtime in order to use newly installed versions.
Go to Runtime -> Restart runtime. Then you can import pandas_datareader and check that it's the right version:
import pandas_datareader
pandas_datareader.__version__ # Should show 0.10.0
Upvotes: 2
Reputation: 499
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
Upvotes: 25