These are two dictionaries:
monkeydict = {'16:43': 1, '16:44': 1, '16:49': 3}
pigdict = {'16:41': 3, '16:44': 2, '16:51': 3}
This is the desired dataframe:
time,monkeydict,pigdict
16:41,,3
16:43,1,
16:44,1,2
16:49,3,
16:51,,3
pd.DataFrame({'monkeydict':pd.Series(monkeydict),'pigdict':pd.Series(pigdict)})
Out[879]:
monkeydict pigdict
16:41 NaN 3.0
16:43 1.0 NaN
16:44 1.0 2.0
16:49 3.0 NaN
16:51 NaN 3.0
Or (Notice here, you need to rename your columns after create the data frame)
pd.DataFrame([monkeydict,pigdict]).T
Out[887]:
0 1
16:41 NaN 3.0
16:43 1.0 NaN
16:44 1.0 2.0
16:49 3.0 NaN
16:51 NaN 3.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With