from scipy.signal import savgol_filter w = savgol_filter(y, 101, 2) plt.plot(x, w, 'b') # high frequency noise removed