|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "code",
|
5 |
| - "execution_count": 1, |
| 5 | + "execution_count": 2, |
6 | 6 | "metadata": {},
|
7 | 7 | "outputs": [],
|
8 | 8 | "source": [
|
|
13 | 13 | },
|
14 | 14 | {
|
15 | 15 | "cell_type": "code",
|
16 |
| - "execution_count": 2, |
| 16 | + "execution_count": 3, |
17 | 17 | "metadata": {},
|
18 | 18 | "outputs": [],
|
19 | 19 | "source": [
|
20 | 20 | "# create a connection to a database\n",
|
21 |
| - "db = sqlite3.connect('games.db')" |
| 21 | + "db = sqlite3.connect(\"games.db\")" |
22 | 22 | ]
|
23 | 23 | },
|
24 | 24 | {
|
25 | 25 | "cell_type": "code",
|
26 |
| - "execution_count": 3, |
| 26 | + "execution_count": 4, |
27 | 27 | "metadata": {},
|
28 | 28 | "outputs": [],
|
29 | 29 | "source": [
|
|
33 | 33 | },
|
34 | 34 | {
|
35 | 35 | "cell_type": "code",
|
36 |
| - "execution_count": 4, |
| 36 | + "execution_count": 5, |
37 | 37 | "metadata": {},
|
38 | 38 | "outputs": [
|
39 | 39 | {
|
40 | 40 | "data": {
|
41 | 41 | "text/plain": [
|
42 |
| - "<sqlite3.Cursor at 0x7fe2e60417c0>" |
| 42 | + "<sqlite3.Cursor at 0x7f10fa1712c0>" |
43 | 43 | ]
|
44 | 44 | },
|
45 |
| - "execution_count": 4, |
| 45 | + "execution_count": 5, |
46 | 46 | "metadata": {},
|
47 | 47 | "output_type": "execute_result"
|
48 | 48 | }
|
|
54 | 54 | },
|
55 | 55 | {
|
56 | 56 | "cell_type": "code",
|
57 |
| - "execution_count": 5, |
| 57 | + "execution_count": 6, |
58 | 58 | "metadata": {},
|
59 | 59 | "outputs": [
|
60 | 60 | {
|
|
93 | 93 | " '1')"
|
94 | 94 | ]
|
95 | 95 | },
|
96 |
| - "execution_count": 5, |
| 96 | + "execution_count": 6, |
97 | 97 | "metadata": {},
|
98 | 98 | "output_type": "execute_result"
|
99 | 99 | }
|
|
105 | 105 | },
|
106 | 106 | {
|
107 | 107 | "cell_type": "code",
|
108 |
| - "execution_count": 6, |
| 108 | + "execution_count": 7, |
109 | 109 | "metadata": {},
|
110 | 110 | "outputs": [
|
111 | 111 | {
|
112 | 112 | "data": {
|
113 | 113 | "text/plain": [
|
114 |
| - "<sqlite3.Cursor at 0x7fe2e60417c0>" |
| 114 | + "<sqlite3.Cursor at 0x7f10fa1712c0>" |
115 | 115 | ]
|
116 | 116 | },
|
117 |
| - "execution_count": 6, |
| 117 | + "execution_count": 7, |
118 | 118 | "metadata": {},
|
119 | 119 | "output_type": "execute_result"
|
120 | 120 | }
|
|
126 | 126 | },
|
127 | 127 | {
|
128 | 128 | "cell_type": "code",
|
129 |
| - "execution_count": 7, |
| 129 | + "execution_count": 8, |
130 | 130 | "metadata": {},
|
131 | 131 | "outputs": [
|
132 | 132 | {
|
|
165 | 165 | " (30, 'RC_Count', '', 0, None, 0)]"
|
166 | 166 | ]
|
167 | 167 | },
|
168 |
| - "execution_count": 7, |
| 168 | + "execution_count": 8, |
169 | 169 | "metadata": {},
|
170 | 170 | "output_type": "execute_result"
|
171 | 171 | }
|
|
177 | 177 | },
|
178 | 178 | {
|
179 | 179 | "cell_type": "code",
|
180 |
| - "execution_count": 8, |
| 180 | + "execution_count": 9, |
181 | 181 | "metadata": {},
|
182 | 182 | "outputs": [
|
183 | 183 | {
|
|
192 | 192 | "# select the game played as 11 vs 11\n",
|
193 | 193 | "cursor.execute(\"select * from games where Number_of_Players == '11';\")\n",
|
194 | 194 | "game11v11 = cursor.fetchall()\n",
|
195 |
| - "print(f\"I have officiated {len(game11v11)} 11 vs 11 games from January 2021 to July 2022.\")" |
| 195 | + "print(\n", |
| 196 | + " f\"I have officiated {len(game11v11)} 11 vs 11 games from January 2021 to July 2022.\"\n", |
| 197 | + ")" |
196 | 198 | ]
|
197 | 199 | },
|
198 | 200 | {
|
199 | 201 | "cell_type": "code",
|
200 |
| - "execution_count": 9, |
| 202 | + "execution_count": 10, |
201 | 203 | "metadata": {},
|
202 | 204 | "outputs": [
|
203 | 205 | {
|
|
217 | 219 | },
|
218 | 220 | {
|
219 | 221 | "cell_type": "code",
|
220 |
| - "execution_count": 10, |
| 222 | + "execution_count": 11, |
221 | 223 | "metadata": {},
|
222 | 224 | "outputs": [
|
223 | 225 | {
|
|
237 | 239 | },
|
238 | 240 | {
|
239 | 241 | "cell_type": "code",
|
240 |
| - "execution_count": 11, |
| 242 | + "execution_count": 12, |
241 | 243 | "metadata": {},
|
242 | 244 | "outputs": [
|
243 | 245 | {
|
|
252 | 254 | "# select the game officiated as assistant referee\n",
|
253 | 255 | "cursor.execute(\"select * from games where Poisition like 'AR%';\")\n",
|
254 | 256 | "AR = cursor.fetchall()\n",
|
255 |
| - "print(f\"I have officiated {len(AR)} games as assistant referee from January 2021 to July 2022.\")" |
| 257 | + "print(\n", |
| 258 | + " f\"I have officiated {len(AR)} games as assistant referee from January 2021 to July 2022.\"\n", |
| 259 | + ")" |
256 | 260 | ]
|
257 | 261 | },
|
258 | 262 | {
|
259 | 263 | "cell_type": "code",
|
260 |
| - "execution_count": 12, |
| 264 | + "execution_count": 13, |
261 | 265 | "metadata": {},
|
262 | 266 | "outputs": [
|
263 | 267 | {
|
|
272 | 276 | "# select the game officiated as 4th official\n",
|
273 | 277 | "cursor.execute(\"select * from games where Poisition == '4th O';\")\n",
|
274 | 278 | "fourthO = cursor.fetchall()\n",
|
275 |
| - "print(f\"I have officiated {len(fourthO)} games as 4th official from January 2021 to July 2022.\")" |
| 279 | + "print(\n", |
| 280 | + " f\"I have officiated {len(fourthO)} games as 4th official from January 2021 to July 2022.\"\n", |
| 281 | + ")" |
276 | 282 | ]
|
277 | 283 | },
|
278 | 284 | {
|
279 | 285 | "cell_type": "code",
|
280 |
| - "execution_count": 24, |
| 286 | + "execution_count": 14, |
281 | 287 | "metadata": {},
|
282 | 288 | "outputs": [
|
283 | 289 | {
|
|
292 | 298 | "# How many Yellow Cards have I given as a referee?\n",
|
293 | 299 | "cursor.execute(\"select sum(YC_Count) from games where Poisition == 'RR';\")\n",
|
294 | 300 | "YC = cursor.fetchall()\n",
|
295 |
| - "print(f\"I have given {YC[0][0]:.0f} Yellow Cards as a referee from January 2021 to July 2022.\")" |
| 301 | + "print(\n", |
| 302 | + " f\"I have given {YC[0][0]:.0f} Yellow Cards as a referee from January 2021 to July 2022.\"\n", |
| 303 | + ")" |
296 | 304 | ]
|
297 | 305 | },
|
298 | 306 | {
|
299 | 307 | "cell_type": "code",
|
300 |
| - "execution_count": 25, |
| 308 | + "execution_count": 15, |
301 | 309 | "metadata": {},
|
302 | 310 | "outputs": [
|
303 | 311 | {
|
|
312 | 320 | "# How many Red Cards have I given as a referee?\n",
|
313 | 321 | "cursor.execute(\"select sum(RC_Count) from games where Poisition == 'RR';\")\n",
|
314 | 322 | "RC = cursor.fetchall()\n",
|
315 |
| - "print(f\"I have given {RC[0][0]:.0f} Red Cards as a referee from January 2021 to July 2022.\")" |
| 323 | + "print(\n", |
| 324 | + " f\"I have given {RC[0][0]:.0f} Red Cards as a referee from January 2021 to July 2022.\"\n", |
| 325 | + ")" |
316 | 326 | ]
|
317 | 327 | },
|
318 | 328 | {
|
319 | 329 | "cell_type": "code",
|
320 |
| - "execution_count": 22, |
| 330 | + "execution_count": 16, |
321 | 331 | "metadata": {},
|
322 | 332 | "outputs": [
|
323 | 333 | {
|
|
332 | 342 | "# How many Yellow Cards per game as a referee?\n",
|
333 | 343 | "cursor.execute(\"select avg(YC_Count) from games where Poisition == 'RR';\")\n",
|
334 | 344 | "YC_per_game = cursor.fetchall()\n",
|
335 |
| - "print(f\"I have given {YC_per_game[0][0]:.2f} Yellow Cards per game as a referee from January 2021 to July 2022.\")" |
| 345 | + "print(\n", |
| 346 | + " f\"I have given {YC_per_game[0][0]:.2f} Yellow Cards per game as a referee from January 2021 to July 2022.\"\n", |
| 347 | + ")" |
336 | 348 | ]
|
337 | 349 | },
|
338 | 350 | {
|
339 | 351 | "cell_type": "code",
|
340 |
| - "execution_count": 23, |
| 352 | + "execution_count": 17, |
341 | 353 | "metadata": {},
|
342 | 354 | "outputs": [
|
343 | 355 | {
|
|
352 | 364 | "# How many Red Cards per game as a referee?\n",
|
353 | 365 | "cursor.execute(\"select avg(RC_Count) from games where Poisition == 'RR';\")\n",
|
354 | 366 | "RC_per_game = cursor.fetchall()\n",
|
355 |
| - "print(f\"I have given {RC_per_game[0][0]:.2f} Red Cards per game as a referee from January 2021 to July 2022.\")" |
| 367 | + "print(\n", |
| 368 | + " f\"I have given {RC_per_game[0][0]:.2f} Red Cards per game as a referee from January 2021 to July 2022.\"\n", |
| 369 | + ")" |
| 370 | + ] |
| 371 | + }, |
| 372 | + { |
| 373 | + "cell_type": "code", |
| 374 | + "execution_count": 33, |
| 375 | + "metadata": {}, |
| 376 | + "outputs": [ |
| 377 | + { |
| 378 | + "name": "stdout", |
| 379 | + "output_type": "stream", |
| 380 | + "text": [ |
| 381 | + "The most cards shown in a game as a referee was 11, (YC: 9, 2nd YC: 2, and RC: 2), 成都龙耀 v 德驰娱乐 (Score:1:2, 成甲总Semi-Final) on 1/16/22 at 锦江仁德 A4.\n", |
| 382 | + "My running distance was 8.13 kilometers. Other officials were: 秦立港、李阳、李飞.\n" |
| 383 | + ] |
| 384 | + } |
| 385 | + ], |
| 386 | + "source": [ |
| 387 | + "# The most cards shown in a game as a referee\n", |
| 388 | + "cursor.execute(\n", |
| 389 | + " \"select Game_Date, YC_Count, YCs_Count, RC_Count, max(YC_Count + RC_Count) as Cards_Max, Team_Home_vs_Away, Game_Type, Stage, Site, Score, Distance, Other_Officials from games where Poisition == 'RR';\"\n", |
| 390 | + ")\n", |
| 391 | + "Cards_Max = cursor.fetchall()\n", |
| 392 | + "print(\n", |
| 393 | + " f\"The most cards shown in a game as a referee was {Cards_Max[0][4]:.0f}, (YC: {Cards_Max[0][1]}, 2nd YC: {Cards_Max[0][2]}, and RC: {Cards_Max[0][3]}), {Cards_Max[0][5]} (Score:{Cards_Max[0][9]}, {Cards_Max[0][6]}{Cards_Max[0][7]}) on {Cards_Max[0][0]} at {Cards_Max[0][8]}.\"\n", |
| 394 | + ")\n", |
| 395 | + "print(\n", |
| 396 | + " f\"My running distance was {Cards_Max[0][10]} kilometers. Other officials were: {Cards_Max[0][11]}.\"\n", |
| 397 | + ")" |
| 398 | + ] |
| 399 | + }, |
| 400 | + { |
| 401 | + "cell_type": "code", |
| 402 | + "execution_count": 36, |
| 403 | + "metadata": {}, |
| 404 | + "outputs": [ |
| 405 | + { |
| 406 | + "name": "stdout", |
| 407 | + "output_type": "stream", |
| 408 | + "text": [ |
| 409 | + "The most distance covered in a game as a referee was 9.90 kilometers, 成都之己 v 成都大学 (Score:2:2, 成超 22 Season YC: 2, 2nd YC: 0, and RC: 0) on 7/3/22 at 城东体育公园.\n" |
| 410 | + ] |
| 411 | + } |
| 412 | + ], |
| 413 | + "source": [ |
| 414 | + "# The most distanced covered in a game as a referee\n", |
| 415 | + "cursor.execute(\n", |
| 416 | + " \"select Game_Date, YC_Count, YCs_Count, RC_Count, max(Distance) as Distance_Max, Team_Home_vs_Away, Game_Type, Stage, Site, Score, Other_Officials from games where Poisition == 'RR';\"\n", |
| 417 | + ")\n", |
| 418 | + "Distance_Max = cursor.fetchall()\n", |
| 419 | + "print(\n", |
| 420 | + " f\"The most distance covered in a game as a referee was {Distance_Max[0][4]} kilometers, {Distance_Max[0][5]} (Score:{Distance_Max[0][9]}, {Distance_Max[0][6]} 22 {Distance_Max[0][7]} YC: {Distance_Max[0][1]}, 2nd YC: {Distance_Max[0][2]}, and RC: {Distance_Max[0][3]}) on {Distance_Max[0][0]} at {Distance_Max[0][8]}.\"\n", |
| 421 | + ")" |
356 | 422 | ]
|
357 | 423 | }
|
358 | 424 | ],
|
|
0 commit comments