import matplotlib.pyplot as plt from scipy.optimize import curve_fit def linear_model(x, a, b): y= a * x + b return y x = [0, 1, 2, 3, 4, 5] y = [15, 10, 9, 6, 2, 0] popt, pcov = curve_fit(linear_model, x, y) print(popt)