This is a code I am trying
import matplotlib.pyplot as plt
import pandas as pd
ticker = \'GLD\'
begdate = \'2014-11-11\'
enddate = \'2016-11-11\'
data1 =
If you import it directly, you get a more verbose import error:
from pandas.io.data import DataReader
ImportError: The pandas.io.data module is moved to a separate package (pandas-datareader). After installing the pandas-datareader package (https://github.com/pydata/pandas-datareader), you can change the import
from pandas.io import data, wb
tofrom pandas_datareader import data, wb
.
Well, you just need 2 things First uninstall the lib -
pip uninstall pandas-datareader
And then need to install it using pip3 (Please notice it is pip3)
pip3 install pandas-datareader
And then use -
from pandas_datareader import data, wb
#..............
#................
data.DataReader()
I have the same issue, here is the solution:
pip install pandas_datareader
Change import pandas.io.data
to from pandas_datareader import data, wb
Use data.DataReader()
to get data from Internet
updated*
good luck~~
My guess is you updated pandas to a newer version which no longer supports io.data
See here for fix http://pandas.pydata.org/pandas-docs/stable/remote_data.html
pandas has removed that functionality and it is now offered as a different package (link):
DataReader The sub-package pandas.io.data is removed in favor of a separately installable pandas-datareader package. This will allow the data modules to be independently updated to your pandas installation. The API for pandas-datareader v0.1.1 is the same as in pandas v0.16.1. (GH8961)
You should replace the imports of the following:
from pandas.io import data, wb
With the following:
from pandas_datareader import data, wb
Install pandas_datareader with pip install pandas-datareader
and replace the code with the following:
from pandas_datareader import data
import datetime as dt
ticker = 'GLD'
begdate = '2014-11-11'
enddate = '2016-11-11'
data1 = data.DataReader(ticker,'yahoo',dt.datetime(2014,11,11),dt.datetime(2016,11,11))
You need to do
import pandas.io.data as web
then you can easily execute
web.DataReader(stuff)
Also, don't forget to import datetime as dt
otherwise you'll catch another exception. Also, I've just was late for 1 sec :(