Skip to content
masterclass Buddy

NumPy · Function

np.polyfit

Fits a polynomial to data by minimizing squared error. It returns coefficients from the highest power to the constant term.

Last updated

Since
1.4

Syntax

numpy.polyfit(x, y, deg, rcond=None, full=False, w=None, cov=False)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • numpy.poly1d
  • numpy.polynomial.Polynomial.fit
  • numpy.linalg.lstsq
  • scipy.interpolate.UnivariateSpline

Source: numpy.polyfit — NumPy v2.5 Manual. Checked 2026-11-03.