python 3.6.5
seasoned python veteran new to pandas and dataframes
given
d = {'time':['2021-08-12 14:59:15.230','2021-08-12 14:59:15.230','2021-08-12 14:59:15.230']
, 'dayy':['14:59:15.231818','14:59:15.231330','14:59:15.232206']
, 'catg':['40B0','4035','40E8']
, 'data':[{'OQWOWF': '0', 'OQD8S1F': '10010100'},{'OQTADT': 30.0, 'OQTAVL': '0', 'OQAOAD': 2},{'OQGS01': '0', 'OQGS02': '0', 'OQGS03': '0'}]
}
df = pd.DataFrame( data=d)
print(df)
yields
time dayy catg data
0 2021-08-12 14:59:15.230 14:59:15.231818 40B0 {'OQWOWF': '0', 'OQD8S1F': '10010100'}
1 2021-08-12 14:59:15.230 14:59:15.231330 4035 {'OQTADT': 30.0, 'OQTAVL': '0', 'OQAOAD': 2}
2 2021-08-12 14:59:15.230 14:59:15.232206 40E8 {'OQGS01': '0', 'OQGS02': '0', 'OQGS03': '0'
how can I merge the dicts into one dict grouped by time? ie
2021-08-12 14:59:15.230 {'OQWOWF': '0', 'OQD8S1F': '10010100', 'OQTADT': 30.0, 'OQTAVL': '0', 'OQAOAD': 2, 'OQGS01': '0', 'OQGS02': '0', 'OQGS03': '0'}
I've gotten the groupby and columns-listed parts down but sense I need either an .apply() or an .agg() function
df.groupby('time')['data'].???
Any ideas?
TIA
Still-learning Steve