Say we have a pandas series with the following values
[np.nan, np.nan, 1, np.nan, 2, np.nan]
What is the most efficient way fill the nan value with 0 in the middle. so we have
[np.nan, np.nan, 1, 0, 2, np.nan]
In other word, how to we do interpolation with a fixed value, or a .fillna
operation but ignore the nan
at the beginning and end of the array.