0
$\begingroup$

what exactly is the "order"-parameter in pandas interpolation?

it is mentioned in the doc:

‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’, ‘spline’, ‘barycentric’, ‘polynomial’: Passed to scipy.interpolate.interp1d. These methods use the numerical values of the index. Both ‘polynomial’ and ‘spline’ require that you also specify an order (int), e.g. df.interpolate(method='polynomial', order=5).
$\endgroup$

1 Answer 1

1
$\begingroup$

The order argument simply refers to the order of the function that is used when interpolating values. As the documentation mentiones, you only need to provide a value for the order argument when you are using either a polynomial or spline for the interpolation. The value then simply refers to the order (or degree) of the polynomial or spline that is used, e.g. a second or third order polynomial. You can find some more info on the documentation of the underlying scipy.interpolate functions that are called, which are interp1d for the polynomial and UnivariateSpline for the spline.

$\endgroup$
1
  • $\begingroup$ But if polynomial interpolation has to fit all the datapoints onto a 3rd degree polynomial, how is it supposed to do that if my datacolumn has 1mio values? $\endgroup$
    – benjamin_z
    Mar 27, 2022 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.