df has an integer column 'X'. For each value, count the distance back to the
previous zero (or the start, whichever is closer). Return this as a Series.
Input
X
0 7
1 2
2 0
3 3
4 4
5 2
6 5
7 0
8 3
9 4
Output
0 1
1 2
2 0
3 1
4 2
5 3
6 4
7 0
8 1
9 2
Name: Y, dtype: int64