0

一些基本的东西:我正在尝试创建一个“正在运行”的查询,在该查询中,对于每个数据点,我都会得到平均值并计数到该点,以及值。例如对于这些测量:

hunger=1 1001
hunger=3 1002
hunger=5 1003
hunger=20 1004

我想生成一个看起来像这样的 csv:

timestamp, hunger, mean, count,
1001, 1, 1, 1
1002, 3, 2, 2,
1003, 5, 3, 3
1004, 20, 7.25, 4

由于这是聚合和选择器查询的混合,我在单独的查询中“饥饿”然后是平均和计数。但是,如果我将两者都分组time(1s),我的平均值和计数将仅与组大小相关;我需要它与当时的整个设置相关...有什么建议吗?

4

1 回答 1

2

你可以这样尝试:

按时间(1s)从饥饿测量组中选择last(hunger)、cumulative_sum(last(hunger))/cumulative_sum(count(hunger))、cumulative_sum(count(hunger))

于 2018-12-24T09:48:00.447 回答