stockticker_data is Pandas dataframe which contains a list of tickers but the for loop is not iterating over the complete list. For some reason it is stopping right after the first list symbol. What do I need to do for it to move on the the next symbol?
stockticker_data = pd.read_csv("Nifty 50 Scraped data.csv")
all_data = {}
for ticker in stockticker_data:
all_data = web.get_data_yahoo(ticker, '1/1/2018', '1/1/2019')
print(all_data)
The output looks like this:
High Low ... Volume Adj Close
Date ...
2018-01-02 172.300003 169.259995 ... 25555900.0 167.701889
2018-01-03 174.550003 171.960007 ... 29517900.0 167.672668
2018-01-04 173.470001 172.080002 ... 22434600.0 168.451508
I had modified the code to
for index, ticker in stockticker_data.iteritems():
all_data.append(web.get_data_yahoo(ticker, '1/1/2018', '1/1/2019'))
print(all_data)
The output did change but still data was pulled for just 1 symbol : Is there something i am missing here ?
[Attributes Adj Close ... Volume
Symbols AXISBANK.NS BAJAJ-AUTO.NS ... YESBANK.NS ZEEL.NS
Date ...
2018-01-01 564.798584 3152.436035 ... 4019878.0 1102118.0
2018-01-02 558.806030 3157.707031 ... 5224976.0 769766.0
2018-01-03 559.754822 3106.240723 ... 5672263.0 1207540.0
2018-01-04 559.205566 3128.667480 ... 5667580.0 1456032.0
2018-01-05 562.551331 3143.427002 ... 30720675.0 1568108.0
... ... ... ... ... ...
2018-12-27 616.783997 2677.074463 ... 44303877.0 5809491.0
2018-12-28 624.274719 2658.001221 ... 27142501.0 6000271.0
2018-12-31 619.131104 2660.593262 ... 18970865.0 2663133.0
2019-01-01 626.521912 2666.950928 ... 24160878.0 2203533.0
2019-01-02 619.280884 2633.059570 ... 32583205.0 2687773.0
[248 rows x 288 columns]]
Process finished with exit code 0