Numpy scipy. Scipy & numpy. импорт numpy. numpy метод наименьших квадратов. from scipy.optimize import least_squares.