I would like to create a new column base on conditions from the Spread column. The logic is:
if Spread is <= 4 then New_column = 4
if Spread is >4 and <=8 then New_column = 8
if Spread is >8 and <=12 Then new New_column = 12
if Spread is >12 Then new New_column = 16 (16 is the cut off.)
I have tried using .where but I have not any luck. I would like the final output to look like below
Spread | New_Column |
---|---|
1 | 4 |
2 | 4 |
5 | 8 |
6 | 8 |
9 | 12 |
11 | 12 |
13 | 16 |