All problems
Temporal Aggregation to Quarterly
Problem
Aggregate a series of monthly values into quarters by summing each complete group of three consecutive values. A trailing partial group is dropped.
Return the list of quarterly sums.
Hint
Range over i in steps of 3 while a full group remains.
Test cases
case 1
in: [[1,2,3,4,5,6]]
expected: [6,15]
case 2
in: [[1,2]]
expected: []
case 3
in: [[3,3,3]]
expected: [9]
case 4
in: [[1,2,3,4]]
expected: [6]
Starter codePython
def temporal_aggregation_quarterly(values):
# Your code here
pass4 test cases · run your code against them in the editor