Python, Data Science, Statistical Analysis, Descriptive Statistics, Hypothesis Testing.
Reshape the variables to fit the model y = y.values.reshape(-1, 1) X = X.values.reshape(-1, 1) # Create and fit the model model = LinearRegression() model.fit(X, y) # Get the model parameters slope = model.coef_[0][0] intercept = model.intercept_[0] r_squared = model.score(X, y) # Print the model