I have created an ordered dictionary in python and enumeration is used for for loop index. It gives following result exactly the way i wanted.
def get_stocks():
tickers = OrderedDict()
for ticker in enumerate(sorted(df_symbol.Symbol)):
tickers[ticker] = "AlphaVantage"
return tickers
It gets me this which is what I need.
OrderedDict([((0, 'HINDALCO'), 'AlphaVantage'), ((1, 'LUPIN'), 'AlphaVantage'), ((2, 'SUNPHARMA'), 'AlphaVantage')])
Now I want to print something like this from above. I am not successful:
['HINDALCO', 'LUPIN', 'SUNPHARMA']
I am doing something like this:
tickers = get_stocks()
ticker_list = list(tickers.keys())
I am getting:
[(0, 'HINDALCO'), (1, 'LUPIN'), (2, 'SUNPHARMA')]