I want to form a pandas dataframe from a dictionary dictionary
:
dictionary =
{0: [1, 2, 3 ,4],
1: [2, 4, 6, 7, 9, 10, ...],
...
}
Values of dictionary
are unequal lists.
I want to a form a dataframe out of this with keys as index and values as list.
Desired dataframe:
df (keys are the index of df)=
Index. Column 1
0 [1, 2, 3 ,4]
1 [2, 4, 6, 7, 9, 10, ...]
...
I tried,
df = pd.DataFrame.from_dict(dictionary, orient='index')
But, it just explodes the number of columns into maximum size of the list in one of the values of dictionary
How to achieve above by forming only one column?