Remain original value if x > 0, else replace with 0.
1. Using Max
x = -10
x = max(0, x)
x
2. Using logical
x = -10
x = x * ( x > 0 )
x
3. Using absolute
x = -10
x = ( abs(x) + x ) / 2
x
Any other suggestion?
Starting off as a muggle that naïve to the Math's and Data Science world.
Remain original value if x > 0, else replace with 0.
x = -10
x = max(0, x)
x
x = -10
x = x * ( x > 0 )
x
x = -10
x = ( abs(x) + x ) / 2
x
Any other suggestion?
Leave a comment