I have a pandas DataFrame with a column like: 0 1 1 2 2 3 4 5 5 0 0 0 I would like to leave any leading zeros, but ffill to replace the trailing zeros with one greater than the previous, nonzero value. In this case, I'd like the output to be: 0 1 1 2 2 3 4 5 5 6 6 6 How can I go about doing this? Continue reading...