Practice: Moving Average
Use convolution to smooth values.
Example
a = np.array([1, 2, 3, 4, 5, 6], dtype=float)
k = np.ones(3) / 3
print(np.convolve(a, k, mode="valid"))Result
[2. 3. 4. 5.]
Exercise
Window average.
np.(a, k, mode="valid")
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.