Ive been using the following code to interpolate with constant extrapolation in the past
from scipy import interpolate
f = interpolate.InterpolatedUnivariateSpline(x,y, k = 3, ext = 3)
but the spline is 'not-a-knot' instead of 'natural'. Now, I know that it is possible to perform natural spline interpolation using
from scipy import interpolate
f = interpolate.CubicSpline(x,y, bc_type = 'natural')
but I don't see an option to add constant extrapolation.
Is there a function/way to do both features at the same time (natural+constant extrapolation)?
Thanks!