time series aggregation by rule


I have a time series data set from a vehicle logger and I want to transform the data set.

I want to measure the time for each valid == false occurence. and aggregate all other columns accordingly (sum, first, integrate etc).

input data set example:

time speed valid

1      0     true
2      0      true
3      1      true
4      1      false
5      2      false
6      3      true
7      2      false
8      1      true
9      0      true


output example:

time duration max_speed

4     2              2
7     1              2

thank you for any hint.

Sorry, I don't understand the logic you are using for transforming your input to your output. Why isn't time = 5 row in your output for example?


Hello Marco

Thank you for your response.

the first event starts at time 4 and is back to true at time 6 so the duration is 2.

the second event starts at time 7 and is back to true at 8 so its duration is 1.



Hi Samuel,

I still don't understand how you calculate the max_speed to be 5 for your first event (it should be 2, isn't it?) but the attached workflow should do pretty much what you need. You can always adjust how the max_speed is calculated by changing the aggregation method in the GroupBy node.

The core of the solution is the code in the Java Snippet (simple) node, used to recognize that start/end of each event and number them accordingly. The rest is just filtering and aggregation with a GroupBy node.

Probably it could have been done with loops and time/series as well, but this way seems pretty straightforward to me.


Hi Marco,

Thank you very much I will try this out .

your right with the Speed I have adapted it.



It worked perfectly, thank you.