I am coding analytics on a financial signal that has output of -1, 0, or 1 and am trying to track how many days it has been since the signal has changed for a daily analytics report.
example: if the tail of my df is 0 1 0 0 0 0 ...
end result goal is a vector like: 0 0 0 1 2 3
How might I go about this? My first thought was a for loop of some kind but I only know how to write those in Python.