Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-008

Square Root Transform

Problem

Apply the square root transform elementwise to a series. This is the Box-Cox transform with lambda = 0.5 and is used to tame increasing variance.

Compute x ** 0.5 and return 0.0 for negative values.

Hint

Use the power operator instead of math.sqrt to keep it simple.

Test cases

case 1
in: [[1,4,9]]
expected: [1,2,3]
case 2
in: [[0,16]]
expected: [0,4]
case 3
in: [[2]]
expected: [1.4142135623730951]
case 4
in: [[-4,9]]
expected: [0,3]
Starter codePython
def sqrt_transform(series):
    # Your code here
    pass

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