6th degree curve fitting with numpy/scipy

curve-fitting, linear-regression, numpy, python, scipy

Solution

Use numpys polyfit routine.

http://docs.scipy.org/doc/numpy-1.3.x/reference/generated/numpy.polyfit.html

Problem

I have a very specific requirement for interpolating nonlinear data using a 6th degree polynomial. I've seen numpy/scipy routines (scipy.interpolate.InterpolatedUnivariateSpline) that allow interpolation only up to degree 5. Even if there's no direct function to do this, is there a way to replicate Excel's LINEST linear regression algorithm in Python? LINEST allows 6th degree curve-fitting but I do NOT want to use Excel for anything as this calculation is part of a much larger Python script. Any help would be appreciated!

Original source