python - Pandas DataFrame not working as intended -
i new python , i'm trying use finance, plotting stock prices. using pandas , dataframe object, reason cannot obtain data need. web.datareader method works, tried in program, code not. here code:
import numpy np import pandas pd import pandas.io.data web symbols = ['aapl', 'msft', 'gld'] data=pd.dataframe() sym in symbols: data[sym] = web.datareader(sym, data_source='yahoo', start='4/14/2014',end='01/30/2015')['adj close'] data.columns=symbols print(data['aapl']) the output empty dataframe , not sure why, because datareader work tried elsewhere.
an update of pandas version >=0.17.1 should solve problem. if use conda (recommended) :
conda update pandas will do.
after update deprecation warning.
to avoid install pandas-datareader:
conda install pandas-datareader and change:
import pandas.io.data web into:
from pandas_datareader import data web
Comments
Post a Comment