I have a Dataframe with one column being dictionaries of different lengths.
It looks something like this
Chrom POS N_Allels dict
0 1 345 2010 {"A":0.1,"T":0.22,"G":0.01}
1 1 357 1989 {"T":0.9}
2 1 365 1850 {"A":0.3,"G":0.2}
I want to explode the dict into two columns, creating a new row for each entry, resulting in something that looks like this
Chrom POS N_Allels base freq
0 1 345 2010 "A" 0.1
1 1 345 2010 "T" 0.22
2 1 345 2010 "G" 0.01
3 1 357 1989 "T" 0.9
4 1 365 1850 "A" 0.3
5 1 365 1850 "G" 0.2
Is there a good, clean way to do that?
I know there exists the df.explode() function, but it only creates a new row for each key of the dict, not the value.