I have a two dictionaries like below
dic1 = { 'T1': ['INC1','INC2','INC3'] , 'T2': ['INC2','INC4','INC5'],'T3': ['INC2']}
dic2 = { 'INC1' :'LOC1','INC2' :'LOC2','INC3' :'LOC3','INC4' :'None','INC5' :'None'}
i have created the data frame for dic1 using following code
import pandas as pd
df_1 = pd.DataFrame.from_dict(dic1, orient='index').stack()
I have got output like below
T1 0 INC1
1 INC2
2 INC3
T2 0 INC2
1 INC4
2 INC5
T3 0 INC2
dtype: object
now i want to conacatenate dic2 by compariing key value pair of dic1 ..and i expected the output like below
T1 0 INC1 LOC1
1 INC2 LOC2
2 INC3 LOC3
T2 0 INC2 LOC2
1 INC4 None
2 INC5 Nnoe
T3 0 INC2 LOC2
dtype: object
I have tried with following code and it says list is not iterable and i tried to use for loop but no luck.
result = {k:dic2[v] for k, v in dic1.items()}
df_2 = pd.DataFrame.from_dict(result , orient='index').stack()
Final_result = pd.concat([df_1, df_2], axis=1)
Could you please help me out to achive the same. Thanks in Advance!!