How to Predict Future Values Using Gathered Information in Python


In this example we will show how to predict future values using the information we have gathered in Python.

Source Code

from scipy import stats

x = [14.4, 16.5, 11.9, 15.4, 18.6, 22.2, 19.5, 25.3, 23.4, 18.2, 22.6, 17.4]
y = [225, 334, 192, 339, 411, 530, 418, 623, 551, 430, 452, 416]

slope, intercept, r_value, p_value, std_err = stats.linregress(x, y)

def myfunc(x):
    return intercept + slope * x

sale = myfunc(20)
print(sale)

Output:

446.8446415387236
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments