I have this dictionary:
d = {1 : [ '2' , 'Pepsi' ], 3 : [ '1' , 'Pepper' ]}
df = pd.DataFrame([[slide, i[0], i[1]] for slide, item in d.items() for i in
item], columns=['Slide', 'Level', 'Level Title'])
I want to have the following output:
slide level 'level1 title' 'level2 title'
1 2 Pepsi
3 1 Pepper
So far, my code outputs this:
slide level 'level title'
1 2 Pepsi
3 1 Pepper
Basically when the first item in the list is 1, the second item in the list should go to 'level1 title', and when the item is 2, the second item should go to 'level2 title'