noshot 0.3.6__py3-none-any.whl → 0.3.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- noshot/data/ML TS XAI/ML Lab CIA/1/1.ipynb +133 -0
- noshot/data/ML TS XAI/ML Lab CIA/2/2.ipynb +139 -0
- noshot/data/ML TS XAI/ML Lab CIA/3/3.ipynb +130 -0
- noshot/data/ML TS XAI/ML Lab CIA/4/4.ipynb +141 -0
- noshot/data/ML TS XAI/TS Lab CIA/1 - AirPassengers/1 - AirPassengers.ipynb +198 -0
- noshot/data/ML TS XAI/TS Lab CIA/2 - Daily-total-female-births/2 - daily-total-female-births.ipynb +209 -0
- noshot/data/ML TS XAI/TS Lab CIA/3 - Bill Charge/3 - Bill Charge.ipynb +169 -0
- noshot/data/ML TS XAI/TS Lab CIA/4 - Daily min temperatures/4 - daily-min-temperatures.ipynb +181 -0
- noshot/data/ML TS XAI/TS Lab CIA/5 - shampoo sales/5 - Shampoo sales.ipynb +213 -0
- {noshot-0.3.6.dist-info → noshot-0.3.7.dist-info}/METADATA +1 -1
- noshot-0.3.7.dist-info/RECORD +53 -0
- noshot/data/ML TS XAI/ML Lab CIA - Healthy directly upload file/1/1.ipynb +0 -255
- noshot/data/ML TS XAI/ML Lab CIA - Healthy directly upload file/2/2.ipynb +0 -399
- noshot/data/ML TS XAI/ML Lab CIA - Healthy directly upload file/3/3.ipynb +0 -276
- noshot/data/ML TS XAI/ML Lab CIA - Healthy directly upload file/4/4.ipynb +0 -265
- noshot/data/ML TS XAI/TSLabCIA-Question order may be different/1 - AirPassengers/1 - AirPassengers.ipynb +0 -563
- noshot/data/ML TS XAI/TSLabCIA-Question order may be different/2 - Daily-total-female-births/2 - daily-total-female-births.ipynb +0 -688
- noshot/data/ML TS XAI/TSLabCIA-Question order may be different/3 - Bill Charge/3 - Bill Charge.ipynb +0 -819
- noshot/data/ML TS XAI/TSLabCIA-Question order may be different/4 - Daily min temperatures/4 - daily-min-temperatures.ipynb +0 -573
- noshot/data/ML TS XAI/TSLabCIA-Question order may be different/5 - shampoo sales/5 - Shampoo sales.ipynb +0 -421
- noshot-0.3.6.dist-info/RECORD +0 -53
- /noshot/data/ML TS XAI/{ML Lab CIA - Healthy directly upload file → ML Lab CIA}/1/Question.txt +0 -0
- /noshot/data/ML TS XAI/{ML Lab CIA - Healthy directly upload file → ML Lab CIA}/1/airfoil_self_noise.dat +0 -0
- /noshot/data/ML TS XAI/{ML Lab CIA - Healthy directly upload file → ML Lab CIA}/2/Question.txt +0 -0
- /noshot/data/ML TS XAI/{ML Lab CIA - Healthy directly upload file → ML Lab CIA}/2/pop_failures.dat +0 -0
- /noshot/data/ML TS XAI/{ML Lab CIA - Healthy directly upload file → ML Lab CIA}/3/Qu.txt +0 -0
- /noshot/data/ML TS XAI/{ML Lab CIA - Healthy directly upload file → ML Lab CIA}/3/go_track_tracks.csv +0 -0
- /noshot/data/ML TS XAI/{ML Lab CIA - Healthy directly upload file → ML Lab CIA}/4/Wilt.csv +0 -0
- /noshot/data/ML TS XAI/{ML Lab CIA - Healthy directly upload file → ML Lab CIA}/4/qu.txt +0 -0
- /noshot/data/ML TS XAI/{TSLabCIA-Question order may be different → TS Lab CIA}/1 - AirPassengers/AirPassengers.csv +0 -0
- /noshot/data/ML TS XAI/{TSLabCIA-Question order may be different → TS Lab CIA}/2 - Daily-total-female-births/daily-total-female-births.csv +0 -0
- /noshot/data/ML TS XAI/{TSLabCIA-Question order may be different → TS Lab CIA}/3 - Bill Charge/bill charge.csv +0 -0
- /noshot/data/ML TS XAI/{TSLabCIA-Question order may be different → TS Lab CIA}/4 - Daily min temperatures/daily-min-temperatures.csv +0 -0
- /noshot/data/ML TS XAI/{TSLabCIA-Question order may be different → TS Lab CIA}/5 - shampoo sales/shampoo_sales.csv +0 -0
- /noshot/data/ML TS XAI/{TSLabCIA-Question order may be different → TS Lab CIA}/Questions TMS 27 Feb 25.pdf +0 -0
- {noshot-0.3.6.dist-info → noshot-0.3.7.dist-info}/LICENSE.txt +0 -0
- {noshot-0.3.6.dist-info → noshot-0.3.7.dist-info}/WHEEL +0 -0
- {noshot-0.3.6.dist-info → noshot-0.3.7.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,198 @@
|
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "code",
|
5
|
+
"execution_count": null,
|
6
|
+
"id": "87ec015f-1801-4aae-a7ae-3c16428341ba",
|
7
|
+
"metadata": {},
|
8
|
+
"outputs": [],
|
9
|
+
"source": [
|
10
|
+
"import pandas as pd\n",
|
11
|
+
"import numpy as np\n",
|
12
|
+
"import matplotlib.pyplot as plt\n",
|
13
|
+
"import seaborn as sns\n",
|
14
|
+
"from statsmodels.tsa.stattools import adfuller\n",
|
15
|
+
"from statsmodels.tsa.seasonal import seasonal_decompose"
|
16
|
+
]
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"cell_type": "code",
|
20
|
+
"execution_count": null,
|
21
|
+
"id": "44d66930-1a1c-4088-868f-2f433939e8fc",
|
22
|
+
"metadata": {},
|
23
|
+
"outputs": [],
|
24
|
+
"source": [
|
25
|
+
"df = pd.read_csv('AirPassengers.csv')\n",
|
26
|
+
"print(\"Dataset Loaded Successfully\")\n",
|
27
|
+
"df.head()"
|
28
|
+
]
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"cell_type": "code",
|
32
|
+
"execution_count": null,
|
33
|
+
"id": "cdc1ab64-0857-4bc6-b09a-58f8531a8f4b",
|
34
|
+
"metadata": {},
|
35
|
+
"outputs": [],
|
36
|
+
"source": [
|
37
|
+
"df['Month'] = pd.to_datetime(df['Month'])\n",
|
38
|
+
"df.set_index('Month', inplace=True)\n",
|
39
|
+
"df.info()"
|
40
|
+
]
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"cell_type": "code",
|
44
|
+
"execution_count": null,
|
45
|
+
"id": "38df2890-85ae-4bf4-a612-7d2a0b1ce1ac",
|
46
|
+
"metadata": {},
|
47
|
+
"outputs": [],
|
48
|
+
"source": [
|
49
|
+
"print(\"\\nDataset Summary:\")\n",
|
50
|
+
"df.describe()"
|
51
|
+
]
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"cell_type": "code",
|
55
|
+
"execution_count": null,
|
56
|
+
"id": "a2347abf-db03-4b8a-be92-6dc2c617367e",
|
57
|
+
"metadata": {},
|
58
|
+
"outputs": [],
|
59
|
+
"source": [
|
60
|
+
"df['Year'] = df.index.year\n",
|
61
|
+
"df['Month_Num'] = df.index.month\n",
|
62
|
+
"yearly_data = df.groupby('Year')['#Passengers'].sum()\n",
|
63
|
+
"monthly_data = df.groupby('Month_Num')['#Passengers'].mean()\n",
|
64
|
+
"print(\"\\nYearly Data:\")\n",
|
65
|
+
"print(yearly_data.head())\n",
|
66
|
+
"print(\"\\nMonthly Data:\")\n",
|
67
|
+
"print(monthly_data.head())"
|
68
|
+
]
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"cell_type": "code",
|
72
|
+
"execution_count": null,
|
73
|
+
"id": "0bee4ef4-6272-410a-87a7-119f68ea98b1",
|
74
|
+
"metadata": {},
|
75
|
+
"outputs": [],
|
76
|
+
"source": [
|
77
|
+
"plt.figure(figsize=(12, 6))\n",
|
78
|
+
"df['#Passengers'].plot(title='Air Passengers Over Time')\n",
|
79
|
+
"plt.xlabel('Year')\n",
|
80
|
+
"plt.ylabel('Number of Passengers')\n",
|
81
|
+
"plt.show()"
|
82
|
+
]
|
83
|
+
},
|
84
|
+
{
|
85
|
+
"cell_type": "code",
|
86
|
+
"execution_count": null,
|
87
|
+
"id": "e7917c24-12a4-4932-a9e7-3d0d1bff8244",
|
88
|
+
"metadata": {},
|
89
|
+
"outputs": [],
|
90
|
+
"source": [
|
91
|
+
"plt.figure(figsize=(8, 5))\n",
|
92
|
+
"plt.hist(df['#Passengers'], bins=20, edgecolor='black')\n",
|
93
|
+
"plt.title(\"Histogram of Passenger Counts\")\n",
|
94
|
+
"plt.xlabel(\"Passengers\")\n",
|
95
|
+
"plt.ylabel(\"Frequency\")\n",
|
96
|
+
"plt.show()"
|
97
|
+
]
|
98
|
+
},
|
99
|
+
{
|
100
|
+
"cell_type": "code",
|
101
|
+
"execution_count": null,
|
102
|
+
"id": "1e34240f-9035-4653-bf4d-b7d4dcad71fc",
|
103
|
+
"metadata": {},
|
104
|
+
"outputs": [],
|
105
|
+
"source": [
|
106
|
+
"sns.kdeplot(df['#Passengers'], fill=True)\n",
|
107
|
+
"plt.title(\"Density Plot of Passenger Counts\")\n",
|
108
|
+
"plt.show()"
|
109
|
+
]
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"cell_type": "code",
|
113
|
+
"execution_count": null,
|
114
|
+
"id": "d136e68a-4d9f-44dd-a604-32a4901cb579",
|
115
|
+
"metadata": {},
|
116
|
+
"outputs": [],
|
117
|
+
"source": [
|
118
|
+
"plt.figure(figsize=(8, 6))\n",
|
119
|
+
"sns.heatmap(df.corr(), annot=True, cmap='coolwarm')\n",
|
120
|
+
"plt.title(\"Correlation Heatmap\")\n",
|
121
|
+
"plt.show()"
|
122
|
+
]
|
123
|
+
},
|
124
|
+
{
|
125
|
+
"cell_type": "code",
|
126
|
+
"execution_count": null,
|
127
|
+
"id": "dcd61b6d-a5bd-4ac8-a8a9-ff67aacef211",
|
128
|
+
"metadata": {},
|
129
|
+
"outputs": [],
|
130
|
+
"source": [
|
131
|
+
"df['Rolling_Mean_3'] = df['#Passengers'].rolling(3).mean()\n",
|
132
|
+
"df['Expanding_Mean'] = df['#Passengers'].expanding().mean()\n",
|
133
|
+
"df.head()"
|
134
|
+
]
|
135
|
+
},
|
136
|
+
{
|
137
|
+
"cell_type": "code",
|
138
|
+
"execution_count": null,
|
139
|
+
"id": "8fc86da3-a4c2-4bd4-adc0-71b00483aaea",
|
140
|
+
"metadata": {},
|
141
|
+
"outputs": [],
|
142
|
+
"source": [
|
143
|
+
"#ADF test\n",
|
144
|
+
"print(\"\\nPerforming ADF Test for Stationarity:\")\n",
|
145
|
+
"adf_result = adfuller(df['#Passengers'])\n",
|
146
|
+
"print(f\"ADF Statistic: {adf_result[0]}\")\n",
|
147
|
+
"print(f\"p-value: {adf_result[1]}\")\n",
|
148
|
+
"print(f\"Critical Values: {adf_result[4]}\")"
|
149
|
+
]
|
150
|
+
},
|
151
|
+
{
|
152
|
+
"cell_type": "code",
|
153
|
+
"execution_count": null,
|
154
|
+
"id": "49a5b13c-b883-47c9-af10-792cf8cca8f4",
|
155
|
+
"metadata": {},
|
156
|
+
"outputs": [],
|
157
|
+
"source": [
|
158
|
+
"decomposed = seasonal_decompose(df['#Passengers'], model='additive', period=12)\n",
|
159
|
+
"plt.figure(figsize=(12, 8))\n",
|
160
|
+
"plt.subplot(411)\n",
|
161
|
+
"plt.plot(df['#Passengers'], label='Original')\n",
|
162
|
+
"plt.legend(loc='best')\n",
|
163
|
+
"plt.subplot(412)\n",
|
164
|
+
"plt.plot(decomposed.trend, label='Trend')\n",
|
165
|
+
"plt.legend(loc='best')\n",
|
166
|
+
"plt.subplot(413)\n",
|
167
|
+
"plt.plot(decomposed.seasonal, label='Seasonality')\n",
|
168
|
+
"plt.legend(loc='best')\n",
|
169
|
+
"plt.subplot(414)\n",
|
170
|
+
"plt.plot(decomposed.resid, label='Residuals')\n",
|
171
|
+
"plt.legend(loc='best')\n",
|
172
|
+
"plt.tight_layout()\n",
|
173
|
+
"plt.show()"
|
174
|
+
]
|
175
|
+
}
|
176
|
+
],
|
177
|
+
"metadata": {
|
178
|
+
"kernelspec": {
|
179
|
+
"display_name": "Python 3 (ipykernel)",
|
180
|
+
"language": "python",
|
181
|
+
"name": "python3"
|
182
|
+
},
|
183
|
+
"language_info": {
|
184
|
+
"codemirror_mode": {
|
185
|
+
"name": "ipython",
|
186
|
+
"version": 3
|
187
|
+
},
|
188
|
+
"file_extension": ".py",
|
189
|
+
"mimetype": "text/x-python",
|
190
|
+
"name": "python",
|
191
|
+
"nbconvert_exporter": "python",
|
192
|
+
"pygments_lexer": "ipython3",
|
193
|
+
"version": "3.12.4"
|
194
|
+
}
|
195
|
+
},
|
196
|
+
"nbformat": 4,
|
197
|
+
"nbformat_minor": 5
|
198
|
+
}
|
noshot/data/ML TS XAI/TS Lab CIA/2 - Daily-total-female-births/2 - daily-total-female-births.ipynb
ADDED
@@ -0,0 +1,209 @@
|
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "code",
|
5
|
+
"execution_count": null,
|
6
|
+
"id": "487cf97a-4bd0-433b-8c0b-db8eb551354a",
|
7
|
+
"metadata": {},
|
8
|
+
"outputs": [],
|
9
|
+
"source": [
|
10
|
+
"import pandas as pd\n",
|
11
|
+
"import numpy as np\n",
|
12
|
+
"import matplotlib.pyplot as plt\n",
|
13
|
+
"import seaborn as sns\n",
|
14
|
+
"from statsmodels.tsa.stattools import adfuller\n",
|
15
|
+
"from statsmodels.tsa.seasonal import seasonal_decompose"
|
16
|
+
]
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"cell_type": "code",
|
20
|
+
"execution_count": null,
|
21
|
+
"id": "dd6a9dc6-1e40-4fd1-8be4-6c69b50d82d8",
|
22
|
+
"metadata": {},
|
23
|
+
"outputs": [],
|
24
|
+
"source": [
|
25
|
+
"df = pd.read_csv('daily-total-female-births.csv')\n",
|
26
|
+
"print(\"Dataset Loaded Successfully\")\n",
|
27
|
+
"df.head()"
|
28
|
+
]
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"cell_type": "code",
|
32
|
+
"execution_count": null,
|
33
|
+
"id": "1aee6411-6105-4d85-ac03-b7b8ec2d190d",
|
34
|
+
"metadata": {},
|
35
|
+
"outputs": [],
|
36
|
+
"source": [
|
37
|
+
"df['Date'] = pd.to_datetime(df['Date'])\n",
|
38
|
+
"df.set_index('Date', inplace=True)\n",
|
39
|
+
"df.info()"
|
40
|
+
]
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"cell_type": "code",
|
44
|
+
"execution_count": null,
|
45
|
+
"id": "64c2371b-1ac2-47e6-89be-9d6456c55c90",
|
46
|
+
"metadata": {},
|
47
|
+
"outputs": [],
|
48
|
+
"source": [
|
49
|
+
"print(\"\\nDataset Summary:\")\n",
|
50
|
+
"df.describe()"
|
51
|
+
]
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"cell_type": "code",
|
55
|
+
"execution_count": null,
|
56
|
+
"id": "81010eaa-b416-47b3-b727-e86da7f8161b",
|
57
|
+
"metadata": {},
|
58
|
+
"outputs": [],
|
59
|
+
"source": [
|
60
|
+
"df['Year'] = df.index.year\n",
|
61
|
+
"df['Month_Num'] = df.index.month\n",
|
62
|
+
"yearly_data = df.groupby('Year')['Births'].sum()\n",
|
63
|
+
"monthly_data = df.groupby('Month_Num')['Births'].mean()\n",
|
64
|
+
"print(\"\\nYearly Data:\")\n",
|
65
|
+
"display(yearly_data.head())\n",
|
66
|
+
"print(\"\\nMonthly Data:\")\n",
|
67
|
+
"display(monthly_data.head())"
|
68
|
+
]
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"cell_type": "code",
|
72
|
+
"execution_count": null,
|
73
|
+
"id": "ca8b19ba-18e3-45c9-8ba9-ba2a1e386cfe",
|
74
|
+
"metadata": {},
|
75
|
+
"outputs": [],
|
76
|
+
"source": [
|
77
|
+
"plt.figure(figsize=(12, 6))\n",
|
78
|
+
"df['Births'].plot(title='Daily Total Female Births Over Time')\n",
|
79
|
+
"plt.xlabel('Year')\n",
|
80
|
+
"plt.ylabel('Number of Births')\n",
|
81
|
+
"plt.show()"
|
82
|
+
]
|
83
|
+
},
|
84
|
+
{
|
85
|
+
"cell_type": "code",
|
86
|
+
"execution_count": null,
|
87
|
+
"id": "21e2a172-9b10-4ac1-acc5-e08fcccb9c83",
|
88
|
+
"metadata": {},
|
89
|
+
"outputs": [],
|
90
|
+
"source": [
|
91
|
+
"plt.figure(figsize=(8, 5))\n",
|
92
|
+
"plt.hist(df['Births'], bins=20, edgecolor='black')\n",
|
93
|
+
"plt.title(\"Histogram of Birth Counts\")\n",
|
94
|
+
"plt.xlabel(\"Births\")\n",
|
95
|
+
"plt.ylabel(\"Frequency\")\n",
|
96
|
+
"plt.show()"
|
97
|
+
]
|
98
|
+
},
|
99
|
+
{
|
100
|
+
"cell_type": "code",
|
101
|
+
"execution_count": null,
|
102
|
+
"id": "425a688c-5125-463d-9061-273ce4558db4",
|
103
|
+
"metadata": {},
|
104
|
+
"outputs": [],
|
105
|
+
"source": [
|
106
|
+
"sns.kdeplot(df['Births'], fill=True)\n",
|
107
|
+
"plt.title(\"Density Plot of Birth Counts\")\n",
|
108
|
+
"plt.show()"
|
109
|
+
]
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"cell_type": "code",
|
113
|
+
"execution_count": null,
|
114
|
+
"id": "91058ea5-efb8-4d74-b1a5-3820deca3417",
|
115
|
+
"metadata": {},
|
116
|
+
"outputs": [],
|
117
|
+
"source": [
|
118
|
+
"sns.boxplot(df['Births'])\n",
|
119
|
+
"plt.title(\"Box and Whisker Plot of Birth Counts\")\n",
|
120
|
+
"plt.show()"
|
121
|
+
]
|
122
|
+
},
|
123
|
+
{
|
124
|
+
"cell_type": "code",
|
125
|
+
"execution_count": null,
|
126
|
+
"id": "ae19d7a0-af99-4c07-9250-13098bf9f436",
|
127
|
+
"metadata": {},
|
128
|
+
"outputs": [],
|
129
|
+
"source": [
|
130
|
+
"df['Rolling_Mean_3'] = df['Births'].rolling(3).mean()\n",
|
131
|
+
"df['Expanding_Mean'] = df['Births'].expanding().mean()\n",
|
132
|
+
"df.head()"
|
133
|
+
]
|
134
|
+
},
|
135
|
+
{
|
136
|
+
"cell_type": "code",
|
137
|
+
"execution_count": null,
|
138
|
+
"id": "9dd9ff6c-4b3b-46d1-85cf-daf6af100b48",
|
139
|
+
"metadata": {},
|
140
|
+
"outputs": [],
|
141
|
+
"source": [
|
142
|
+
"df_resampled = df.resample('W').mean() # Weekly resampling\n",
|
143
|
+
"interpolated_df = df.interpolate(method='linear') # Linear interpolation\n",
|
144
|
+
"interpolated_df.head()"
|
145
|
+
]
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"cell_type": "code",
|
149
|
+
"execution_count": null,
|
150
|
+
"id": "bfa32ab5-48ee-4aff-8217-881e8429ebe8",
|
151
|
+
"metadata": {},
|
152
|
+
"outputs": [],
|
153
|
+
"source": [
|
154
|
+
"#(ADF Test)\n",
|
155
|
+
"print(\"\\nPerforming ADF Test for Stationarity:\")\n",
|
156
|
+
"adf_result = adfuller(df['Births'])\n",
|
157
|
+
"print(f\"ADF Statistic: {adf_result[0]}\")\n",
|
158
|
+
"print(f\"p-value: {adf_result[1]}\")\n",
|
159
|
+
"print(f\"Critical Values: {adf_result[4]}\")"
|
160
|
+
]
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"cell_type": "code",
|
164
|
+
"execution_count": null,
|
165
|
+
"id": "4aecf4be-05a1-4bae-8b6b-c5f5e5f49480",
|
166
|
+
"metadata": {},
|
167
|
+
"outputs": [],
|
168
|
+
"source": [
|
169
|
+
"decomposed = seasonal_decompose(df['Births'], model='additive', period=7)\n",
|
170
|
+
"plt.figure(figsize=(12, 8))\n",
|
171
|
+
"plt.subplot(411)\n",
|
172
|
+
"plt.plot(df['Births'], label='Original')\n",
|
173
|
+
"plt.legend(loc='best')\n",
|
174
|
+
"plt.subplot(412)\n",
|
175
|
+
"plt.plot(decomposed.trend, label='Trend')\n",
|
176
|
+
"plt.legend(loc='best')\n",
|
177
|
+
"plt.subplot(413)\n",
|
178
|
+
"plt.plot(decomposed.seasonal, label='Seasonality')\n",
|
179
|
+
"plt.legend(loc='best')\n",
|
180
|
+
"plt.subplot(414)\n",
|
181
|
+
"plt.plot(decomposed.resid, label='Residuals')\n",
|
182
|
+
"plt.legend(loc='best')\n",
|
183
|
+
"plt.tight_layout()\n",
|
184
|
+
"plt.show()"
|
185
|
+
]
|
186
|
+
}
|
187
|
+
],
|
188
|
+
"metadata": {
|
189
|
+
"kernelspec": {
|
190
|
+
"display_name": "Python 3 (ipykernel)",
|
191
|
+
"language": "python",
|
192
|
+
"name": "python3"
|
193
|
+
},
|
194
|
+
"language_info": {
|
195
|
+
"codemirror_mode": {
|
196
|
+
"name": "ipython",
|
197
|
+
"version": 3
|
198
|
+
},
|
199
|
+
"file_extension": ".py",
|
200
|
+
"mimetype": "text/x-python",
|
201
|
+
"name": "python",
|
202
|
+
"nbconvert_exporter": "python",
|
203
|
+
"pygments_lexer": "ipython3",
|
204
|
+
"version": "3.12.4"
|
205
|
+
}
|
206
|
+
},
|
207
|
+
"nbformat": 4,
|
208
|
+
"nbformat_minor": 5
|
209
|
+
}
|
@@ -0,0 +1,169 @@
|
|
1
|
+
{
|
2
|
+
"cells": [
|
3
|
+
{
|
4
|
+
"cell_type": "code",
|
5
|
+
"execution_count": null,
|
6
|
+
"id": "5a3e5b8d-cfa8-4e7d-9641-3bf6a3366818",
|
7
|
+
"metadata": {},
|
8
|
+
"outputs": [],
|
9
|
+
"source": [
|
10
|
+
"import pandas as pd\n",
|
11
|
+
"import numpy as np\n",
|
12
|
+
"import matplotlib.pyplot as plt\n",
|
13
|
+
"import seaborn as sns\n",
|
14
|
+
"from statsmodels.tsa.stattools import adfuller\n",
|
15
|
+
"from statsmodels.graphics.tsaplots import plot_acf, plot_pacf"
|
16
|
+
]
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"cell_type": "code",
|
20
|
+
"execution_count": null,
|
21
|
+
"id": "08f9b3df-ed97-4353-9a21-1a5b1894263c",
|
22
|
+
"metadata": {},
|
23
|
+
"outputs": [],
|
24
|
+
"source": [
|
25
|
+
"bill_data = pd.read_csv(\"bill charge.csv\")\n",
|
26
|
+
"bill_data.head()"
|
27
|
+
]
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"cell_type": "code",
|
31
|
+
"execution_count": null,
|
32
|
+
"id": "b66bbac2-8762-46d7-a4ea-374d5088a62b",
|
33
|
+
"metadata": {},
|
34
|
+
"outputs": [],
|
35
|
+
"source": [
|
36
|
+
"print(\"Dataset Loaded Successfully\")\n",
|
37
|
+
"display(bill_data.info())\n",
|
38
|
+
"display(bill_data.head())"
|
39
|
+
]
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"cell_type": "code",
|
43
|
+
"execution_count": null,
|
44
|
+
"id": "8c1f8430-5973-4533-aac8-56aa7bdd6507",
|
45
|
+
"metadata": {},
|
46
|
+
"outputs": [],
|
47
|
+
"source": [
|
48
|
+
"bill_data['Date'] = pd.to_datetime(bill_data['Date'])\n",
|
49
|
+
"\n",
|
50
|
+
"bill_data['Year'] = bill_data['Date'].dt.year\n",
|
51
|
+
"bill_data['Month'] = bill_data['Date'].dt.month\n",
|
52
|
+
"\n",
|
53
|
+
"bill_data_numeric = bill_data[['Date', 'Bill Charge', 'Year', 'Month']]\n",
|
54
|
+
"\n",
|
55
|
+
"grouped = bill_data_numeric.groupby(['Year', 'Month'])['Bill Charge'].sum().reset_index()"
|
56
|
+
]
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"cell_type": "code",
|
60
|
+
"execution_count": null,
|
61
|
+
"id": "74b2cf18-25d6-4707-8b32-81b588106545",
|
62
|
+
"metadata": {},
|
63
|
+
"outputs": [],
|
64
|
+
"source": [
|
65
|
+
"plt.figure(figsize=(12, 5))\n",
|
66
|
+
"sns.histplot(bill_data['Bill Charge'], bins=20, kde=True)\n",
|
67
|
+
"plt.title(\"Histogram of Bill Charges\")\n",
|
68
|
+
"plt.show()"
|
69
|
+
]
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"cell_type": "code",
|
73
|
+
"execution_count": null,
|
74
|
+
"id": "c4e0af23-6eb9-477f-9a96-680f330b4a77",
|
75
|
+
"metadata": {},
|
76
|
+
"outputs": [],
|
77
|
+
"source": [
|
78
|
+
"sns.kdeplot(bill_data['Bill Charge'], fill=True)\n",
|
79
|
+
"plt.title(\"Density Plot of Bill Charges\")\n",
|
80
|
+
"plt.show()"
|
81
|
+
]
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"cell_type": "code",
|
85
|
+
"execution_count": null,
|
86
|
+
"id": "9a0540e9-6a05-47cf-8bd3-af5dfbc6d1c4",
|
87
|
+
"metadata": {},
|
88
|
+
"outputs": [],
|
89
|
+
"source": [
|
90
|
+
"plot_acf(bill_data['Bill Charge'])\n",
|
91
|
+
"plt.show()\n",
|
92
|
+
"\n",
|
93
|
+
"plot_pacf(bill_data['Bill Charge'])\n",
|
94
|
+
"plt.show()"
|
95
|
+
]
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"cell_type": "code",
|
99
|
+
"execution_count": null,
|
100
|
+
"id": "728ec23f-b955-4aa8-887c-71a32f87df5a",
|
101
|
+
"metadata": {},
|
102
|
+
"outputs": [],
|
103
|
+
"source": [
|
104
|
+
"bill_data['Rolling_Mean_3'] = bill_data['Bill Charge'].rolling(window=3).mean()\n",
|
105
|
+
"bill_data['Expanding_Mean'] = bill_data['Bill Charge'].expanding().mean()\n",
|
106
|
+
"bill_data.head()"
|
107
|
+
]
|
108
|
+
},
|
109
|
+
{
|
110
|
+
"cell_type": "code",
|
111
|
+
"execution_count": null,
|
112
|
+
"id": "65a31329-f845-4f31-84f5-7620bcd7913e",
|
113
|
+
"metadata": {},
|
114
|
+
"outputs": [],
|
115
|
+
"source": [
|
116
|
+
"adf_result = adfuller(bill_data['Bill Charge'])\n",
|
117
|
+
"print(\"ADF Statistic:\", adf_result[0])\n",
|
118
|
+
"print(\"p-value:\", adf_result[1])"
|
119
|
+
]
|
120
|
+
},
|
121
|
+
{
|
122
|
+
"cell_type": "code",
|
123
|
+
"execution_count": null,
|
124
|
+
"id": "ea818bd6-58b8-4cbe-a1ae-311a5409c4d6",
|
125
|
+
"metadata": {},
|
126
|
+
"outputs": [],
|
127
|
+
"source": [
|
128
|
+
"bill_data['Date'] = pd.to_datetime(bill_data['Date'])\n",
|
129
|
+
"\n",
|
130
|
+
"bill_data.set_index('Date', inplace=True)\n",
|
131
|
+
"\n",
|
132
|
+
"bill_data['Bill Charge'] = pd.to_numeric(bill_data['Bill Charge'], errors='coerce')\n",
|
133
|
+
"bill_data.dropna(subset=['Bill Charge'], inplace=True)\n"
|
134
|
+
]
|
135
|
+
},
|
136
|
+
{
|
137
|
+
"cell_type": "code",
|
138
|
+
"execution_count": null,
|
139
|
+
"id": "512a802a-2039-45c7-8306-d99a2a0add4f",
|
140
|
+
"metadata": {},
|
141
|
+
"outputs": [],
|
142
|
+
"source": [
|
143
|
+
"bill_data = bill_data.drop_duplicates(keep = 'first')\n",
|
144
|
+
"bill_data"
|
145
|
+
]
|
146
|
+
}
|
147
|
+
],
|
148
|
+
"metadata": {
|
149
|
+
"kernelspec": {
|
150
|
+
"display_name": "Python 3 (ipykernel)",
|
151
|
+
"language": "python",
|
152
|
+
"name": "python3"
|
153
|
+
},
|
154
|
+
"language_info": {
|
155
|
+
"codemirror_mode": {
|
156
|
+
"name": "ipython",
|
157
|
+
"version": 3
|
158
|
+
},
|
159
|
+
"file_extension": ".py",
|
160
|
+
"mimetype": "text/x-python",
|
161
|
+
"name": "python",
|
162
|
+
"nbconvert_exporter": "python",
|
163
|
+
"pygments_lexer": "ipython3",
|
164
|
+
"version": "3.12.4"
|
165
|
+
}
|
166
|
+
},
|
167
|
+
"nbformat": 4,
|
168
|
+
"nbformat_minor": 5
|
169
|
+
}
|