How can I conditionally count in each row the number of instances where theres a value in the previous date then decrease to 0 in the next date?
df:
Jan Feb Mar Apr
A 1 2 3 0
B 0 0 0 0
C 1 0 2 0
D 0 0 0 1
want to get: df_to_zero_count
Count
A 1
B 0
C 2
D 0
I've tried some combination of apply and iterating through columns but can't seem to make it work.