I see a comment below saying do it in containers like list or dictionary. Could you give me an example that will have the same effect like having a variable?
I wrote some pseudo-input code and the final output I wanted to see (Just to have these variables in the system)
input:
List_Tickers = {AMZN, FB, AAPL} def dataDataframe(symbols,TradeApp_obj): "returns extracted historical data in dataframe format" df_data = {} for symbol in symbols: df_data[symbol] = pd.DataFrame(TradeApp_obj.data[symbols.index(symbol)]) df_data[symbol].set_index("Date",inplace=True) return df_data for ticker in List_Tickers df_{}.format(ticker)= pd.DataFrame[ticker]
output:
df_AMZN = pd.DataFrame["AMZN"] df_FB = pd.DataFrame["FB"] df_AAPL = pd.DataFrame["AAPL"]
extra information
a. I want to just change the contents within List_Tickers that it just auto-generate these dataframes and variables.
b. The above function dataDataframe() will generate dataframes for each ticker.
c. In the end, I want to save these dataframes into excel files individually for its ticker