Given a 1-D float array possibly containing np.nan, return a copy where each NaN is replaced by the most recent preceding non-NaN value. Leading NaNs, before any observation, stay NaN.
Input
[nan 1. nan nan 5. nan]
Output
[nan 1. 1. 1. 5. 5.]