Skip to content
DeepForgeby svx
All problems
MediumTime Seriests-113

Multiple Seasonal Indices

Problem

Combine two seasonal index vectors multiplicatively: return indices1[t % len(indices1)] * indices2[t % len(indices2)].

Return 0.0 if either vector is empty or t is negative. This models two overlapping calendar effects, such as weekly and annual cycles.

Hint

Take each index modulo its own cycle length before multiplying.

Test cases

case 1
in: [[0.9,1.1,1],[1.2,0.8],4]
expected: 1.32
case 2
in: [[0.9,1.1,1],[1.2,0.8],0]
expected: 1.08
case 3
in: [[1.5],[2,0.5],5]
expected: 0.75
case 4
in: [[],[1],0]
expected: 0
Starter codePython
def multiple_seasonal_indices(indices1, indices2, t):
    # Your code here
    pass

4 test cases · run your code against them in the editor