'Interpolate function in Pandas Dataframe

Which are the equations used to interpolate a DataFrame in Pandas?

Reading the following link, I couldn't find anything related to them.

https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.interpolate.html

I need exactly this:

enter image description here

But I'm not sure if the interpolate() function is doing the same thing. If that's the case, is there anyway I can change it to work like that?

EDIT: Example of dataframe:

df = pd.DataFrame([[np.nan, 10, np.nan, 20, 17, np.nan, np.nan, 14, np.nan, 10, np.nan],
                  [5, np.nan, 0, np.nan, np.nan, np.nan, 5, np.nan, 10, np.nan, np.nan],
                  [3, np.nan, np.nan, np.nan, np.nan, np.nan, 2, np.nan, np.nan, np.nan, np.nan],
                  [np.nan, np.nan, np.nan, 3, 4, 5, np.nan, 7, 8, 9, np.nan]],
                  columns=['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'])


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source