这里有两个数据子列表,请帮我按时间戳对相应的数据进行分组
我试过的代码 :( John Galt帮我解决了这个问题)
flat = [y for x in L for y in x] # L is the list
[x[0] for x in flat] + [x[1] for x in flat]
[x[0] for x in L[0]] + [y[1] for x in L for y in x]
[[('2017-08-08 10:00:38', 5.0), ('2017-08-08 10:05:38', 8.0), ('2017-08-08 10:10:38', 7.5), ('2017-08-08 10:15:38', 8.3), ('2017-08-08 10:20:38', 5.0), ('2017-08-08 10:25:38', 5.0), ('2017-08-08 10:30:38', 5.0), ('2017-08-08 10:35:38', 5.0), ('2017-08-08 10:40:38', 55.0), ('2017-08-08 10:45:38', 85.0), ('2017-08-08 10:50:38', 55.0), ('2017-08-08 10:55:38', 5.0), ('2017-08-08 11:00:38', 53.0)],
[('2017-08-08 10:00:38', 11.2), ('2017-08-08 10:05:38', 10.0), ('2017-08-08 10:10:38', 13.0), ('2017-08-08 10:15:38', 101.0), ('2017-08-08 10:25:38', 10.0), ('2017-08-08 10:30:38', 10.0), ('2017-08-08 10:35:38', 110.0), ('2017-08-08 10:45:38', 100.5), ('2017-08-08 10:50:38', 100.5), ('2017-08-08 10:55:38', 10.05), ('2017-08-08 11:00:38', 10.10)]]
期望的输出:
['2017-08-08 10:00:38','5.0','10.0'],['2017-08-08 10:05:38','25.0','30.0'],['2017-08-08 10:15:38','25.0','35.0']