I am trying to generate multiple pandas data frames within a loop, I am having difficulty with the variable definitions though. The first iteration of str(test[i-1]) returns A, so I assumed I could concatenate this string with another string to create a variable, the first variable should be defined as A_data_columns=['Test1','Test2'] however this throws an error (which I half expected), I was just wondering if there is a way to do this properly, or perhaps a better way?
test=[]
for i in range(1,5):
test.append(chr(ord('@')+i))
str(test[i-1])+'_data_columns'=['Test1', 'Test2']
str(test[i-1])+'_dataframe'=pd.DataFrame(columns=str(test[i-1])+'_data_columns')
str(test[i-1])+'_dataframe'
Error:
SyntaxError: cannot assign to operator