Skip to content
DeepForgeby svx
All problems
MediumTime Seriests-334

Seasonal Index Normalization

Problem

Normalize a list of multiplicative seasonal indices so that they average to one, by dividing each index by the mean of the list.

Return the indices unchanged when their mean is zero, and an empty list for empty input.

Hint

Indices averaging to one preserve the overall level of a seasonal decomposition.

Test cases

case 1
in: [[0.8,1.2]]
expected: [0.8,1.2]
case 2
in: [[2,4]]
expected: [0.6666666666666666,1.3333333333333333]
case 3
in: [[2,0,4]]
expected: [1,0,2]
case 4
in: [[0,0]]
expected: [0,0]
Starter codePython
def normalize_seasonal_indices(indices):
    # Your code here
    pass

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