Skip to content
Advertisement

Extrapolating using Pandas and Curve_fit error func() takes 3 positional arguments but 4 were given

JavaScript

I’m using the code from another post to extrapolate values. I changed the func() so that it is linear not cubic however I get an error “func() takes 3 positional arguments but 4 were give”

Extrapolate values in Pandas DataFrame is where I got the original code. My question is how would I change it so it works with a linear relationship

Advertisement

Answer

When using: guess = (0.5,0.5) you should be able to make it run.

You have the parameters a, b while the original example had the parameters a, b, c, d. The initial guess is for the parameters a, b in your function, not for x.

Full code used to make your interpolation function run:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement