How can I use the xbar function to aggregate rows in a table in 10 microsecond bars. The table consists of the columns timestamp
and val
. For aggregating in millisecond bars instead I already know that I can simply use timestamp.datetime
in the xbar query.
A possible result table should look as follows:
timestamp | val
--------------------------| ---
2015.12.02D12:19:44.434430| 2
2015.12.02D12:19:44.434440| 8
2015.12.02D12:19:44.434450| 5
Any help is appreciated.
The below should work:
d:([]t:asc .z.P+100*10?100;v:10?10)
select avg v by (10*1000) xbar t from d
Note that the output time column is still a 'timestamp' ("p") type, however the values are barred in microseconds.
I wrote the first xbar argument as (10*1000) for clarity. To change to 5 microseconds you can do (5*1000) etc.
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