How can I get a running total of consecutive 1's in a pandas Series?
For example, s = pd.Series([5, 1, 4, 1, 1, 2, 3, 1, 1, 1, 4]). I want to obtain pd.Series([0, 1, 0, 1, 2, 0, 0, 1, 2, 3, 0]).
(Pandas 0.18.0)
How can I get a running total of consecutive 1's in a pandas Series?
For example, s = pd.Series([5, 1, 4, 1, 1, 2, 3, 1, 1, 1, 4]). I want to obtain pd.Series([0, 1, 0, 1, 2, 0, 0, 1, 2, 3, 0]).
(Pandas 0.18.0)