我有以下代码:
resdata = dict()
rows = result.rows.all()
for key, group in groupby(rows, lambda x: x.space):
row = list()
for item in group:
cell = {
'time': item.time,
'value': item.value
}
row.append(cell)
resdata[key] = row
样本 resdata 将是:
resdata = [
{
"skl": "nn_skl:5608",
"cols": [
{
"value": 115.396956868,
"time": "2012-06-02 00:00:00"
},
{
"value": 112.501399874,
"time": "2012-06-03 00:00:00"
},
{
"value": 106.528068506,
"time": "2012-06-18 00:00:00"
}
],
"len": 226
},
{
"skl": "nn_skl:5609",
"cols": [
{
"value": 114.541167284,
"time": "2012-06-02 00:00:00"
},
],
"len": 226
},
{
"skl": "nn_skl:5610",
"cols": [
{
"value": 105.887267189,
"time": "2012-06-18 00:00:00"
}
],
"len": 225
}
]
我想要做的是在所有单元格中获得最大的“价值”和最大的“时间”。