test = DataFrame(Time1 = [DateTime(2022, 1, 1, 10, 0, 0), DateTime(2022, 1, 1, 10, 5, 0), DateTime(2022, 1, 1, 10, 14, 0)], Time2 = [DateTime(2022, 1, 1, 10, 15, 0), DateTime(2022, 1, 1, 10, 10, 0), DateTime(2022, 1, 1, 10, 20, 0)],
Value = [10, 15, 20])
Given the test dataframe above, I want to convert it to every single time range that can be constructed with the Value column summed up for all the times that lie in that time range as shown in the result below:
result = DataFrame(Time1 = [DateTime(2022, 1, 1, 10, 0, 0), DateTime(2022, 1, 1, 10, 5, 0), DateTime(2022, 1, 1, 10, 10, 0), DateTime(2022, 1, 1, 10, 14, 0), DateTime(2022, 1, 1, 10, 15, 0)],
Time2 = [DateTime(2022, 1, 1, 10, 5, 0), DateTime(2022, 1, 1, 10, 10, 0), DateTime(2022, 1, 1, 10, 14, 0), DateTime(2022, 1, 1, 10, 15, 0), DateTime(2022, 1, 1, 10, 20, 0)], ValueSum = [10, 25, 10, 30,20 ])
Any idea how to achieve this?