I am currently working with a dataset containing sensordata. I wish to get some summary statistics. More precisely I wish to get the number of visits, and the total occupancy length. One visit is defined if there are several 0 values over X amount of minutes after a timestamp having value 1
my data looks like this
SensorId timestamp value
1 10:10:10 1
1 10:12:10 1
1 10:14:00 1
1 10:16:00 0
1 10:18:00 0
1 10:20:00 0
2 13:10:10 1
2 13:12:10 1
2 13:14:00 1
2 13:20:00 1
2 13:22:00 0
this is my desired result:
SensorId total time in use Number of visits
1 4 1
2 10 1
there are quite a lot of rows, so I wish for the total time in use, and number of visits to update each time.