Fit of two different functions with boarder as fit parameter
问题 I have a question about a simple fit function in Python. I am trying to fit two different functions on a data set and the border between the two regimes should be also a fit parameter. Very naively I was trying something like this: def FitFunc(x, a, b, c, d, e, border): if x < border: return a * x + b if x > border: return c * x**2 + d * x + e But I got a ValueError: The truth value of a Series is ambiguous. Use a.empty(), a.bool(), a.item(), a.any() or a.all() I understand that you can not