I would like to transform a DataFrame looking like this:
dictionary
0 {'b': 2, 'a': 1}
1 {'c': 4, 'b': 3}
from
import pandas
df = pandas.DataFrame()
df['dictionary'] = [{'a':1,'b':2},{'b': 3,'c':4}]
onto a DataFrame looking like this:
dictionary a b c
0 {'b': 2, 'a': 1} 1.0 2 NaN
1 {'c': 4, 'b': 3} NaN 3 4.0
where (of course) the order of the columns does not matter.
How can I do this without explicitly looping through the dictionaries or the rows ?