Path: blob/master/Time Forecasting using Python/4.2 Predict Profit using Linear Regression .ipynb
3074 views
Kernel: Python 3 (ipykernel)
In [2]:
Profit=C1(Date)+C2(Sales)+C3(Qty)+Intercep+Error
In [10]:
Out[10]:
In [12]:
Out[12]:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 60 entries, 0 to 59
Data columns (total 2 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Date 60 non-null object
1 Profit 60 non-null float64
dtypes: float64(1), object(1)
memory usage: 1.1+ KB
In [16]:
Out[16]:
0 2015-01-31
1 2015-02-28
2 2015-03-31
3 2015-04-30
4 2015-05-31
5 2015-06-30
6 2015-07-31
7 2015-08-31
8 2015-09-30
9 2015-10-31
10 2015-11-30
11 2015-12-31
12 2016-01-31
13 2016-02-29
14 2016-03-31
15 2016-04-30
16 2016-05-31
17 2016-06-30
18 2016-07-31
19 2016-08-31
20 2016-09-30
21 2016-10-31
22 2016-11-30
23 2016-12-31
24 2017-01-31
25 2017-02-28
26 2017-03-31
27 2017-04-30
28 2017-05-31
29 2017-06-30
30 2017-07-31
31 2017-08-31
32 2017-09-30
33 2017-10-31
34 2017-11-30
35 2017-12-31
36 2018-01-31
37 2018-02-28
38 2018-03-31
39 2018-04-30
40 2018-05-31
41 2018-06-30
42 2018-07-31
43 2018-08-31
44 2018-09-30
45 2018-10-31
46 2018-11-30
47 2018-12-31
48 2019-01-31
49 2019-02-28
50 2019-03-31
51 2019-04-30
52 2019-05-31
53 2019-06-30
54 2019-07-31
55 2019-08-31
56 2019-09-30
57 2019-10-31
58 2019-11-30
59 2019-12-31
Name: Date, dtype: object
In [17]:
In [18]:
In [19]:
In [20]:
Out[20]:
In [25]:
Out[25]:
Date Predicted Profit
0 2020-12-31 8340.280127
1 2021-12-31 7816.856193
2 2022-12-31 7293.432260
3 2023-12-31 6770.008326
In [26]:
Out[26]:
In [23]:
Out[23]:
1066359.30492475
In [24]:
Out[24]:
array([-1.43403817])
In [ ]:
fORECAST_pRPFIT = M(DATES)+ INTERCEPT+e1(MSE/rmse)
Forecasted Profit = -DATE(.32)+25K