I wish to create a dictionary of dataframes so I can pass into a function. Each dataframe is just a single line string.
Input:
test1=['1','2'] dn=['x','y'] Mag =['tet1','tet2'] pm=['1','2'] keys=[] final_list=[] df = pd.DataFrame() for num1 in test1: for num2 in dn: for num3 in Mag: for num4 in pm: keys.append(f'sw{num4}O{num1}{num2}{num3}') final_list.append(f'mp{num4}-ghfg{num1}-{num2}-{num3}') df=pd.DataFrame(final_list) df.append(df) d = {} d= dict(zip(keys, df)) Output:
In d['sw1O1xtet1']
Out 0
Desired Output: a dataframe containing the single line string 'mp1-ghfg1-x-tet1' corresponding to its key... NOt sure how to fix this...
dfas a[]and next you use it asDataFrame- why?df = pd.DataFrame(). Still investigating.