I'm trying to replace nan values in a DataFrame with a split of the first previous available value across all the following nan values.
In the example below :
import pandas as pd
df = [100, None, None, 40, None, 120]
df = pd.DataFrame(df)
I would like to get :
[33.33, 33.33, 33.33, 20, 20, 120]
If I could find a way to count the number of nan values following each value in my column, then I could run some computations to achieve the split.