1. Home
  2. Data Science
  3. NumPy
  4. What does the np.polyfit() function do in NumPy?

Added 24 Feb 2024

What does the np.polyfit() function do in NumPy?

  1. Fits a polynomial of specified degree to a set of data points Correct answer
  2. Computes the inverse of a polynomial
  3. Computes the roots of a polynomial
  4. Computes the derivatives of a polynomial

Correct answer

A. Fits a polynomial of specified degree to a set of data points

15 views

MCQSEXAM

Explanation

np.polyfit() fits a polynomial of a specified degree to data points using least squares and returns the coefficients, highest power first. np.polyfit(x, y, 1) gives the slope and intercept of the best-fit line.

Use np.polyval() to evaluate the fitted polynomial.

Keep preparing with more Data Science MCQs on MCQsExam.com.

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More NumPy MCQs

Practise all NumPy MCQs

Similar MCQs