Find the Weight Values using Linear Regression Analysis in Python
Try the scikit-learn library.

From the documentation for linear regression:
"LinearRegression fits a linear model with coefficients w = (w1, ..., wp) to minimize the residual sum of squares between the observed targets in the dataset, and the targets predicted by the linear approximation."

https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html