I am trying to create multiple dataframes from the existing dictionaries. But after the loop finishes, the dataframes are not saved/made.
L1 = ['A','B','C',]
D1 = {'A':[1,2,3],'B':[4,5,6],'C':[7,8,9]}
D2 = {'A':['aa','bb','cc'],'B':['dd','ee','ff'],'C':['gg','hh','ii']}
D3 = {'A':['100','101','102'],'B':['103','104','105'],'C':['106','107','108']}
for each in L1:
each = pd.DataFrame({(each+'1'):D1[each],(each+'2'):D2[each]},index=D3[each])
print (A)
Error message
NameError: name 'A' is not defined
I know the dataframe is once created since if I print/show the dataframe within the loop then it's ok.
But I want all dataframes to be saved so I can use later. Appreciate the help!