The dataframe looks like this:
d = {'ID': [1, 2,3],'V':['F','G','H'],'AAA':[0,1,1],'AA':[0,2,2],'A':[0,3,3],'BBB':[0,4,4]}
df2 = pd.DataFrame(data=d)
and dictionary looks like this:
dct ={1:{'F':[2,3,5],'G':[3,5,6],'H':[6,7,8]},
2:{'F':[1,3,5],'G':[8,5,6],'H':[9,7,8]},
3:{'F':[5,3,5],'G':[4,5,6],'H':[10,7,8]}
}
Based on value of 'ID' and 'V' I can access list from dictionary i.e. dct[2]['G']. How can I apply a merge on this?
In short, I want to append particular list as a row to dataframe.
Intended result should be like following:
op_d = {'ID': [1, 2,3],'V':['F','G','H'],'AAA':[0,1,1],'AA':[0,2,2],'A':[0,3,3],'BBB':[0,4,4],'Q1':[2,8,10],'Q2':[3,5,7],'Q3':[5,6,8]}
output_df = pd.DataFrame(data=op_d )