Given a dict:
{1: [1,2,3,4,5], 2: [55,22,112]}
I want to build a dataframe:
key_id ids
1 1
1 2
1 3
1 4
1 5
2 55
2 22
2 112
How can I do this?
I am trying to play with pd.DataFrame.from_dict() but it seems as not the right approach.
Also tried to run over the dict, and create a list with the same key as long as the value list's length.
Is there any efficient way to do this?
P.S sometimes it will be a dataframe as value:
{0: pd.DataFrame({'id': {0: 3}})}