Python natural smoothing splines : <p>I am trying to find a python package that would give an option to fit <em>natural smoothing splines</em> with user selectable smoothing factor. Is there an implementation for that? If not, how would you use what is available to implement it yourself?</p>

<ul>
<li><p>By natural spline I mean that there should be a condition that the second derivative of the fitted function at the endpoints is zero (linear).</p></li>
<li><p>By smoothing spline I mean that the spline should not be 'interpolating' (passing through all the datapoints). I would like to decide the correct smoothing factor lambda (see the <a href="https://en.wikipedia.org/wiki/Smoothing_spline" rel="noreferrer">Wikipedia page</a> for smoothing splines) myself.</p></li>
</ul>

<h2>What I have found</h2>

<ul>
<li><p>scipy.interpolate.CubicSpline [<a href="https://docs.scipy.org/doc/scipy-1.1.0/reference/generated/scipy.interpolate.CubicSpline.html#scipy.interpolate.CubicSpline" rel="noreferrer">link</a>]: Does natural (cubic) spline fitting. Does interpolation, and there is no way to smooth the data.</p></li>
<li><p>scipy.interpolate.UnivariateSpline [<a href="https://docs.scipy.org/doc/scipy-1.1.0/reference/generated/scipy.interpolate.UnivariateSpline.html#scipy.interpolate.UnivariateSpline" rel="noreferrer">link</a>]: Does spline fitting with user selectable smoothing factor. However, there is no option to make the splines natural.</p></li>
</ul>
