I'm trying to determine the growth rate for two EPS values: the current quarter vs the same quarter a year ago. The challenge that I'm finding is that depending if the earnings are positive or negative, the sign on the growth rate is not correct. I would normally just use a conditional statement and apply a negative sign correctly, but this is all captured in factors and I haven't been able to figure out how to conditionally change the sign. I tried "np.where" but got errors.
The standard percentage growth formula is obviously:
growth = (Current - Previous) / Previous
However if EPS go from -$1 a share to $5 a share then it would be:
growth = -6 = (5 -- 1)/-1.
So in this case, the growth is -6, but it had positive growth. I'm trying to make my algorithm distinguish between negative growth and positive growth. (This seems like a fairly newbie question)
I've attached a notebook to hopefully make it easier for someone to help.
Thanks!
--Brian