Python Forum

Full Version: 1 I cant read many stocks(list) with pandas-datareader from yahoo
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
import pandas_datareader as pdr
import datetime 
import pandas as pd

largecap = pd.read_excel('largecap.xlsx')
antalrader = len(largecap.index)

stocks = list()

x = 0
while x < antalrader:
   stocks.insert(x, largecap.Yahoo[x])
   x += 1

ls_key = 'Adj Close'
start = datetime.datetime(2016, 1, 1)
end = datetime.datetime(2016, 1, 31)   
f = pdr.DataReader(stocks, 'yahoo', start, end)
Error message:
/Users/david.soderstrom/anaconda3/lib/python3.6/site-packages/pandas_datareader/yahoo/ SymbolWarning: Failed to read symbol: 'AHSL.ST', replacing with NaN.
 warnings.warn(msg.format(sym), SymbolWarning)
Why can't i read the symbols from yahoo? I have 122 values in the list. If i write:
pdr.DataReader(AHSL.ST, 'yahoo', start, end)
It does read correctly from yahoo.
The only thing I can think of is that there's some character you can't see there, like a unicode space or something.  What do you see if you do: print([ord(ch) for ch in stocks[121]])?