I am trying to fit a polynomial regression model to a dataset. When I run the following code I get the error: too many values to unpack (3). How can I solve this problem?
return (a * x) + (b * x**2) + c
x,y = xdata, ydata
popt, _ = curve_fit(objective, x, y, maxfev = 2000)
a,b,c = popt
print('y = %.5f * x + %.5f * x^2 + %.5f' % (a, b, c))
pyplot.scatter(x,y)
x_line = arrange(min(x), max(x), 1)
y_line = objective(x_line, a, b, c)
pyplot.plot(x_line, y_line, '--', color='red')
pyplot.show()
As you can see below in the screenshot I get the error when I run the code.
Any suggestions?

Please include your imports or make them obvious. Searching for all possible curve_fit functions that you may have called is kind of annoying
As someone else remarked, your problem is that you try to unpack 3 values from a tuple or list that has fewer entries.
Specifically, popt is the set of optimized parameters.
scipy.optimize.curve_fitdetermines the number of parameters through introspection. I assume that your objective function has only one or two parameters.