How to pass parameter to fit function when using scipy.optimize.curve_fit
问题 I am trying to fit some data that I have using scipy.optimize.curve_fit. My fit function is: def fitfun(x, a): return np.exp(a*(x - b)) What i want is to define a as the fitting parameter, and b as a parameter that changes depending on the data I want to fit. This means that for one set of data I would want to fit the function: np.exp(a*(x - 10)) while for another set I would like to fit the function np.exp(a*(x - 20)) . In principle, I would like the parameter b to be passed in as any value.