File size: 8,816 Bytes
1d31989
 
 
 
 
 
 
 
 
 
 
1d3c9ee
1d31989
 
 
 
 
f4930a4
 
 
1d31989
 
 
 
1d3c9ee
 
 
 
f4930a4
 
 
 
 
 
 
 
1d3c9ee
 
 
 
 
 
 
1d31989
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f4930a4
 
1d31989
 
 
 
 
 
 
 
 
 
f4930a4
1d31989
f4930a4
 
1d31989
f4930a4
1d31989
 
 
f4930a4
1d31989
 
 
 
f4930a4
1d31989
f4930a4
 
 
1d31989
 
f4930a4
 
 
 
1d31989
 
 
f4930a4
1d31989
f4930a4
 
 
 
1d31989
f4930a4
1d31989
f4930a4
 
1d31989
 
 
f4930a4
1d31989
f4930a4
 
1d31989
 
 
 
 
 
 
 
 
 
f4930a4
1d31989
f4930a4
 
 
 
1d31989
f4930a4
 
 
 
1d31989
 
 
f4930a4
1d31989
f4930a4
 
 
 
 
1d31989
 
f4930a4
 
1d31989
 
 
f4930a4
 
 
 
 
 
 
 
 
 
 
 
1d31989
 
 
 
 
 
f4930a4
 
 
 
 
 
 
 
 
1d31989
f4930a4
 
 
 
 
 
 
 
 
1d31989
 
f4930a4
1d31989
 
 
 
 
f4930a4
1d31989
 
 
 
f4930a4
1d31989
 
 
 
 
f4930a4
1d31989
 
f4930a4
1d31989
 
 
 
 
f4930a4
1d31989
 
 
 
f4930a4
1d31989
 
 
 
 
f4930a4
1d31989
 
f4930a4
1d31989
 
 
 
 
f4930a4
1d31989
 
 
 
 
1d3c9ee
1d31989
 
 
 
 
 
 
 
 
 
 
 
 
1d3c9ee
1d31989
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "c:\\Users\\elikl\\Documents\\Uni\\yr3\\ML for industry\\utrecht-pollution-prediction\\.venv\\Lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
      "  from .autonotebook import tqdm as notebook_tqdm\n"
     ]
    }
   ],
   "source": [
    "from src.predict import get_data_and_predictions\n",
    "from src.data_api_calls import get_combined_data\n",
    "from src.past_data_api_calls import get_past_combined_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Data is already up to date.\n",
      "Data is already up to date.\n",
      "Number of rows with missing values dropped: 7\n",
      "Data is already up to date.\n",
      "Number of rows with missing values dropped: 7\n"
     ]
    }
   ],
   "source": [
    "week_data, predictions_O3, predictions_NO2 = get_data_and_predictions()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>NO2</th>\n",
       "      <th>O3</th>\n",
       "      <th>wind_speed</th>\n",
       "      <th>mean_temp</th>\n",
       "      <th>global_radiation</th>\n",
       "      <th>percipitation</th>\n",
       "      <th>pressure</th>\n",
       "      <th>minimum_visibility</th>\n",
       "      <th>humidity</th>\n",
       "      <th>weekday</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2024-10-17</td>\n",
       "      <td>22.804605</td>\n",
       "      <td>22.769160</td>\n",
       "      <td>51</td>\n",
       "      <td>169</td>\n",
       "      <td>43</td>\n",
       "      <td>6</td>\n",
       "      <td>10100</td>\n",
       "      <td>371</td>\n",
       "      <td>86</td>\n",
       "      <td>Thursday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2024-10-18</td>\n",
       "      <td>23.268500</td>\n",
       "      <td>23.307332</td>\n",
       "      <td>21</td>\n",
       "      <td>155</td>\n",
       "      <td>42</td>\n",
       "      <td>39</td>\n",
       "      <td>10140</td>\n",
       "      <td>45</td>\n",
       "      <td>97</td>\n",
       "      <td>Friday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2024-10-19</td>\n",
       "      <td>23.910064</td>\n",
       "      <td>23.171714</td>\n",
       "      <td>41</td>\n",
       "      <td>147</td>\n",
       "      <td>43</td>\n",
       "      <td>16</td>\n",
       "      <td>10141</td>\n",
       "      <td>228</td>\n",
       "      <td>89</td>\n",
       "      <td>Saturday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2024-10-20</td>\n",
       "      <td>22.573238</td>\n",
       "      <td>23.537845</td>\n",
       "      <td>81</td>\n",
       "      <td>155</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>10160</td>\n",
       "      <td>415</td>\n",
       "      <td>83</td>\n",
       "      <td>Sunday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2024-10-21</td>\n",
       "      <td>21.145700</td>\n",
       "      <td>24.020696</td>\n",
       "      <td>58</td>\n",
       "      <td>144</td>\n",
       "      <td>27</td>\n",
       "      <td>43</td>\n",
       "      <td>10206</td>\n",
       "      <td>220</td>\n",
       "      <td>92</td>\n",
       "      <td>Monday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>2024-10-22</td>\n",
       "      <td>21.776580</td>\n",
       "      <td>23.335886</td>\n",
       "      <td>53</td>\n",
       "      <td>114</td>\n",
       "      <td>57</td>\n",
       "      <td>49</td>\n",
       "      <td>10269</td>\n",
       "      <td>226</td>\n",
       "      <td>92</td>\n",
       "      <td>Tuesday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>2024-10-23</td>\n",
       "      <td>21.974794</td>\n",
       "      <td>22.214689</td>\n",
       "      <td>36</td>\n",
       "      <td>112</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>10328</td>\n",
       "      <td>65</td>\n",
       "      <td>97</td>\n",
       "      <td>Wednesday</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>2024-10-24</td>\n",
       "      <td>25.512568</td>\n",
       "      <td>20.913710</td>\n",
       "      <td>56</td>\n",
       "      <td>104</td>\n",
       "      <td>62</td>\n",
       "      <td>0</td>\n",
       "      <td>10247</td>\n",
       "      <td>130</td>\n",
       "      <td>94</td>\n",
       "      <td>Thursday</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        date        NO2         O3  wind_speed  mean_temp  global_radiation  \\\n",
       "0 2024-10-17  22.804605  22.769160          51        169                43   \n",
       "1 2024-10-18  23.268500  23.307332          21        155                42   \n",
       "2 2024-10-19  23.910064  23.171714          41        147                43   \n",
       "3 2024-10-20  22.573238  23.537845          81        155                 0   \n",
       "4 2024-10-21  21.145700  24.020696          58        144                27   \n",
       "5 2024-10-22  21.776580  23.335886          53        114                57   \n",
       "6 2024-10-23  21.974794  22.214689          36        112                12   \n",
       "7 2024-10-24  25.512568  20.913710          56        104                62   \n",
       "\n",
       "   percipitation  pressure  minimum_visibility  humidity    weekday  \n",
       "0              6     10100                 371        86   Thursday  \n",
       "1             39     10140                  45        97     Friday  \n",
       "2             16     10141                 228        89   Saturday  \n",
       "3              5     10160                 415        83     Sunday  \n",
       "4             43     10206                 220        92     Monday  \n",
       "5             49     10269                 226        92    Tuesday  \n",
       "6              0     10328                  65        97  Wednesday  \n",
       "7              0     10247                 130        94   Thursday  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "week_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[10.33808859, 16.00098432, 19.64377496]])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "predictions_O3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[25.68519992, 25.76030745, 31.21057679]])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "predictions_NO2"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}