Trying to create a pandas data frame for each stock ticker in a list
My Code:
for ticker in stock_tickers:
data = pd.read_csv(f'{ticker}_{get_date()}.csv')
it will only create one pandas data frame for the last stock ticker... is there anyway for this to be done all of them?
.append()the newly created pandas dataframedatajust happens to be the last dataframe, the only one that didn't get overwritten. Really you need to read andpd.concat ()multiple dataframes, with an extra column for 'ticker'. Dataframes don't magically concatenate themselves, you have to do that explicitly.