Python Forum
1 I cant read many stocks(list) with pandas-datareader from yahoo - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: 1 I cant read many stocks(list) with pandas-datareader from yahoo (/thread-7202.html)



1 I cant read many stocks(list) with pandas-datareader from yahoo - Davidii111 - Dec-27-2017

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


print(type(stocks[121]))
ls_key = 'Adj Close'
start = datetime.datetime(2016, 1, 1)
end = datetime.datetime(2016, 1, 31)   
f = pdr.DataReader(stocks, 'yahoo', start, end)
print(f)
Error message:
/Users/david.soderstrom/anaconda3/lib/python3.6/site-packages/pandas_datareader/yahoo/daily.py:136: 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.


RE: 1 I cant read many stocks(list) with pandas-datareader from yahoo - nilamo - Dec-27-2017

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]])?