I have a column
A=[0,0,1,2,3,0,0,0,1,2,4,6,0,0,1,2,3,0]
and would like to return one column with the length of each consecutive set of numbers that differs from 0. In another column I would like to return the cumulative sum of each consecutive set of numbers that differs from 0.
For A this would result in [3,4,3] and [6,13,6]
Thank you
Best Answer