is_fail = df.Status != 'OK'
cumulative_fails = is_fail.cumsum()
fail_idx, = is_fail.nonzero()
days_since_last_fail = arange(len(is_fail))
days_since_last_fail[fail_idx[0]:] -= fail_idx[cumulative_fails[fail_idx[0]
    :] - 1]
Calculate difference between values using a filter using Pandas