I am trying to do the following:
Supposing I have the following column on pandas, where there will be always two values that are equal in sequence.
l = [np.nan, np.nan, 10, np.nan, np.nan, np.nan, 10, np.nan, 4, np.nan, 4, 5, np.nan, 5, np.nan, 2, np.nan, 2, 1, 1]
How can I fill NaN values only in between the interval of similar values ?
expected output:
[np.nan, np.nan, 10, 10, 10, 10, 10, np.nan, 4, 4, 4, 5, 5, 5, np.nan, 2, 2, 2, 1, 1]
I could only find this answer, which is not the same problem: