smooth interpolation python

Solutions on MaxInterview for smooth interpolation python by the best coders in the world

showing results for - "smooth interpolation python"
Rene
20 Feb 2016
1>>> from scipy.interpolate import UnivariateSpline
2>>> x, y = np.array([1, 2, 3, 4]), np.array([1, np.nan, 3, 4])
3>>> w = np.isnan(y)
4>>> y[w] = 0.
5>>> spl = UnivariateSpline(x, y, w=~w)
6
Philomène
02 Apr 2019
1spl.set_smoothing_factor(0.5)
2plt.plot(xs, spl(xs), 'b', lw=3)
3plt.show()
4