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
1spl.set_smoothing_factor(0.5)
2plt.plot(xs, spl(xs), 'b', lw=3)
3plt.show()
4