I have a dictionary with tuples as keys and values as lists. I would like to convert it to a pandas dataframe for exporting it as an Excel table later.
Could someone suggest a clean way to achieve the table as below? I would like to have the elements in the list in separate columns.
dict={(a,b):[1,2][4,5],(a,c):[7,8][1,3],(b,c):[1,8][1,3]}
| K | X | Y |
|---|---|---|
| a,b | 1 | 2 |
| a,b | 4 | 5 |
| a,c | 7 | 8 |
| a,c | 1 | 3 |
| b,c | 1 | 8 |
| b,c | 1 | 3 |
Tried this, not getting desired result:
df=pd.DataFrame.from_dict(dict, orient='index').T