Let's say, I have a dictionary like below
sample_dict= { 'A':[[1,2,3],[4,5,6]],
'B':[[7,8,9],[10,11,12]],
'C':[[13,14,15]]}
I would like to convert this dictionary to dataframe like below.
Expected Output:
|----------------|-------------|------------|----------|
| keys | col1 | col2 | col3 |
|----------------|-------------|------------|----------|
| A | 1 | 2 | 3 |
|----------------|-------------|------------|----------|
| A | 4 | 5 | 6 |
|----------------|-------------|------------|----------|
| B | 7 | 8 | 9 |
|----------------|-------------|------------|----------|
| B | 10 | 11 | 12 |
|----------------|-------------|------------|----------|
| c | 13 | 14 | 15 |
|----------------|-------------|------------|----------|
while performing this below code
df=pd.DataFrame.from_dict(sample_dict,orient='index')
df
I'm getting the resultant output as:
|----------------|-------------|--------------|
| | 0 | 1 |
|----------------|-------------|--------------|
| A | [1,2,3] | [4,5,6] |
|----------------|-------------|--------------|
| B | [7,8,9] | [10,11,12] |
|----------------|-------------|--------------|
| C | [13,14,15] | None |
|----------------|-------------|--------------|
Ideas are welcome!!
Thanks in Advance!!