I think there's a way - not necessarily very nice.
You should, for each row, extract te following parts:
1) the time from "start" to the next hour
2) what the next hour is
3) the time to "end" from the previous hour
4) what the previous hour is
5) the number of hours fully covered.
Each of these is relatively easy to get with vectorized operations.
Now, you want to sum 1) by groupby-ing on 2) and 3) by groupby-ing on
4), then add together the two results.
Finally, for i = 1 to n, where n is the maximum duration of a single
task, you want to count rows where 5) is => i, shift the result by (i-
1), and sum, groupby-ing on 2).
Add these together, multiply by 1 hour, add the result of the previous
part, and you should be done.
(I bet there's a way of avoiding even the loop from 1 to n)
Pietro
Il giorno gio, 17/09/2020 alle 19.23 +0300, Josh Friedlander ha
scritto: