Filling Strategies
Fill with a constant, the mean or the previous value.
Example
s = pd.Series([1.0, None, 3.0, None])
print(s.fillna(s.mean()).tolist())
print(s.ffill().tolist())
print(s.interpolate().tolist())Result
[1.0, 2.0, 3.0, 2.0] [1.0, 1.0, 3.0, 3.0] [1.0, 2.0, 3.0, 3.0]
Exercise
Forward fill.
s.()
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.