Filling NAN values in Pandas by using previous values
You can convert your data to_timedelta, ffill and add 1 second:
df['col1'] = pd.to_timedelta(df['col1'])

df['col1'] = df['col1'].ffill().add(df['col1'].isna()*pd.Timedelta('1s'))

Output:
             col1
0 0 days 08:30:18
1 0 days 08:30:19
2 0 days 08:30:20
3 0 days 08:30:21
4 0 days 08:30:22

Used input:
df = pd.DataFrame({'col1': ['8:30:18', '8:30:19', '8:30:20', np.nan, '8:30:22']})

converting back to strings
Use a custom function:
def to_str(s):
    h,m = s.dt.total_seconds().divmod(3600)
    m,s = m.divmod(60)
    return (h.astype(int).astype(str).str.zfill(2)
            +':'+
            m.astype(int).astype(str).str.zfill(2)
            +':'+
            s.astype(int).astype(str).str.zfill(2)
            )
    
df['col1'] = to_str(df['col1'])

Output:
       col1
0  08:30:18
1  08:30:19
2  08:30:20
3  08:30:21
4  08:30:22


I have a Pandas DataFrame in the following format.

I am trying to fill the NaN value by using the most recent non-NaN value and adding one second to the time value. For example, in this case, the program should take the most recent non-NaN value of 8:30:20 and add one second to replace the NaN value. So, the replacement value should be 8:30:21. Is there a way in Pandas to simulate this process for the entire column?
