From f60bdb8d16dbeccbffae9cae952e70519fd0ddf4 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Sat, 4 Oct 2025 21:58:17 +0800 Subject: [PATCH 01/16] Committed on or around 2025/10/04 --- .../2025/September/At_city_level.py | 1 + .../2025/September/At_city_level_h_bar.py | 0 2 files changed, 1 insertion(+) create mode 100644 The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2025/September/At_city_level.py delete mode 100644 The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2025/September/At_city_level_h_bar.py diff --git a/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2025/September/At_city_level.py b/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2025/September/At_city_level.py new file mode 100644 index 00000000..792d6005 --- /dev/null +++ b/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2025/September/At_city_level.py @@ -0,0 +1 @@ +# diff --git a/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2025/September/At_city_level_h_bar.py b/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2025/September/At_city_level_h_bar.py deleted file mode 100644 index e69de29b..00000000 From 10997ff8db41be4e456d6ae03d448177c0d3d75f Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Thu, 11 Dec 2025 16:20:36 +0800 Subject: [PATCH 02/16] Committed on or around 2025/12/14 --- Medley/2025 Level 4 Local Civil Servant Exam.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Medley/2025 Level 4 Local Civil Servant Exam.py diff --git a/Medley/2025 Level 4 Local Civil Servant Exam.py b/Medley/2025 Level 4 Local Civil Servant Exam.py new file mode 100644 index 00000000..e69de29b From 43ec197951fa92fd4f3e40097f18e5ee8120d3c5 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Thu, 11 Dec 2025 16:23:57 +0800 Subject: [PATCH 03/16] Committed on or around 2025/12/14 --- ...ervant Exam.py => 2025 Level 4 Local Civil Servant Exam 28.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Medley/{2025 Level 4 Local Civil Servant Exam.py => 2025 Level 4 Local Civil Servant Exam 28.py} (100%) diff --git a/Medley/2025 Level 4 Local Civil Servant Exam.py b/Medley/2025 Level 4 Local Civil Servant Exam 28.py similarity index 100% rename from Medley/2025 Level 4 Local Civil Servant Exam.py rename to Medley/2025 Level 4 Local Civil Servant Exam 28.py From d2fdd5dbb84a2415e5418f687e774d680a617cbe Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Thu, 11 Dec 2025 18:43:17 +0800 Subject: [PATCH 04/16] Committed on or around 2025/12/14 --- Medley/2025 Level 4 Local Civil Servant Exam 28.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Medley/2025 Level 4 Local Civil Servant Exam 28.py b/Medley/2025 Level 4 Local Civil Servant Exam 28.py index e69de29b..6d0dc81e 100644 --- a/Medley/2025 Level 4 Local Civil Servant Exam 28.py +++ b/Medley/2025 Level 4 Local Civil Servant Exam 28.py @@ -0,0 +1,5 @@ +i = 2; + +def func_a(a): + func_b(a); + i = a + 1; \ No newline at end of file From 3ab882e5b7467677ac7262e866ae1648b8ca4dbd Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Thu, 11 Dec 2025 18:50:57 +0800 Subject: [PATCH 05/16] Committed on or around 2025/12/14 --- Medley/2025 Level 4 Local Civil Servant Exam 28.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Medley/2025 Level 4 Local Civil Servant Exam 28.py b/Medley/2025 Level 4 Local Civil Servant Exam 28.py index 6d0dc81e..885fef31 100644 --- a/Medley/2025 Level 4 Local Civil Servant Exam 28.py +++ b/Medley/2025 Level 4 Local Civil Servant Exam 28.py @@ -2,4 +2,6 @@ def func_a(a): func_b(a); - i = a + 1; \ No newline at end of file + i = a + 1; +def func_b(n): + i = b + 1; \ No newline at end of file From 32f221dde1c08ee61353cdabbbc62cb3f25dac2c Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Thu, 11 Dec 2025 18:54:26 +0800 Subject: [PATCH 06/16] Committed on or around 2025/12/14 --- Medley/2025 Level 4 Local Civil Servant Exam 28.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Medley/2025 Level 4 Local Civil Servant Exam 28.py b/Medley/2025 Level 4 Local Civil Servant Exam 28.py index 885fef31..288d982d 100644 --- a/Medley/2025 Level 4 Local Civil Servant Exam 28.py +++ b/Medley/2025 Level 4 Local Civil Servant Exam 28.py @@ -3,5 +3,11 @@ def func_a(a): func_b(a); i = a + 1; -def func_b(n): - i = b + 1; \ No newline at end of file +def func_b(b): + i = b + 1; + func_c(i); +def func_c(c): + i = c + 1; + +func_a(i) +print(i) From c2d60ec20e3f606fd895bd2cf9df0a5d12c626d1 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Thu, 11 Dec 2025 18:54:58 +0800 Subject: [PATCH 07/16] Committed on or around 2025/12/14 --- ...ant Exam 28.py => 2025 Level 4 Local Civil Servant Exam 18.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Medley/{2025 Level 4 Local Civil Servant Exam 28.py => 2025 Level 4 Local Civil Servant Exam 18.py} (100%) diff --git a/Medley/2025 Level 4 Local Civil Servant Exam 28.py b/Medley/2025 Level 4 Local Civil Servant Exam 18.py similarity index 100% rename from Medley/2025 Level 4 Local Civil Servant Exam 28.py rename to Medley/2025 Level 4 Local Civil Servant Exam 18.py From 321424fb72d67702817b6d2af806fdfbab1170a9 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Thu, 11 Dec 2025 19:59:21 +0800 Subject: [PATCH 08/16] Committed on or around 2025/12/14 --- Medley/2025 Level 4 Local Civil Servant Exam 17.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 Medley/2025 Level 4 Local Civil Servant Exam 17.py diff --git a/Medley/2025 Level 4 Local Civil Servant Exam 17.py b/Medley/2025 Level 4 Local Civil Servant Exam 17.py new file mode 100644 index 00000000..2618653f --- /dev/null +++ b/Medley/2025 Level 4 Local Civil Servant Exam 17.py @@ -0,0 +1 @@ +d = {1: {'1':'3', '2':3.14}, 2:{'1':'2', '2':2.71}, 3:{'1':'1','2':1.44}} \ No newline at end of file From c0fa8b2443dd07d5b8f30b83da966f216b6d45e0 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Thu, 11 Dec 2025 20:00:59 +0800 Subject: [PATCH 09/16] Committed on or around 2025/12/14 --- Medley/2025 Level 4 Local Civil Servant Exam 17.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Medley/2025 Level 4 Local Civil Servant Exam 17.py b/Medley/2025 Level 4 Local Civil Servant Exam 17.py index 2618653f..23d953f8 100644 --- a/Medley/2025 Level 4 Local Civil Servant Exam 17.py +++ b/Medley/2025 Level 4 Local Civil Servant Exam 17.py @@ -1 +1,9 @@ -d = {1: {'1':'3', '2':3.14}, 2:{'1':'2', '2':2.71}, 3:{'1':'1','2':1.44}} \ No newline at end of file +d = {1: {'1':'3', '2':3.14}, 2:{'1':'2', '2':2.71}, 3:{'1':'1','2':1.44}} + +print(d[1][1]) + +print(d[1]['2']) + +print(d[2][1]) + +print(d[2]['2']) From ab5ae03f10b14db766cb96d6e98d8fd23f060d80 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Thu, 11 Dec 2025 20:02:22 +0800 Subject: [PATCH 10/16] Committed on or around 2025/12/14 --- Medley/2025 Level 4 Local Civil Servant Exam 17-2.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Medley/2025 Level 4 Local Civil Servant Exam 17-2.py diff --git a/Medley/2025 Level 4 Local Civil Servant Exam 17-2.py b/Medley/2025 Level 4 Local Civil Servant Exam 17-2.py new file mode 100644 index 00000000..e01d9ee6 --- /dev/null +++ b/Medley/2025 Level 4 Local Civil Servant Exam 17-2.py @@ -0,0 +1,9 @@ +d = {1: {'1':'3', '2':3.14}, 2:{'1':'2', '2':2.71}, 3:{'1':'1','2':1.44}} + +# print(d[1][1]) + +print(d[1]['2']) + +# print(d[2][1]) + +print(d[2]['2']) From 3bf74528d31eeed253e54e8247228799e8f5d950 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Fri, 24 Apr 2026 13:51:44 +0800 Subject: [PATCH 11/16] Committed on or around 2026/04/24 --- .../Monthly_total_job_openings_by_region/2026/April/__init__.py | 0 .../2026/February/__init__.py | 0 .../Monthly_total_job_openings_by_region/2026/January/__init__.py | 0 .../Monthly_total_job_openings_by_region/2026/March/__init__.py | 0 .../Monthly_total_job_openings_by_region/2026/__init__.py | 0 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/April/__init__.py create mode 100644 The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/February/__init__.py create mode 100644 The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/January/__init__.py create mode 100644 The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/March/__init__.py create mode 100644 The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/__init__.py diff --git a/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/April/__init__.py b/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/April/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/February/__init__.py b/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/February/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/January/__init__.py b/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/January/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/March/__init__.py b/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/March/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/__init__.py b/The attainments and realizations of my dreams/Monthly_total_job_openings_by_region/2026/__init__.py new file mode 100644 index 00000000..e69de29b From 6e086c50b6efbeb3f5e531ff0e3d4315b027746d Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Mon, 11 May 2026 21:07:13 +0800 Subject: [PATCH 12/16] Committed on or around 2026/5/11 --- .../Road safety/Year_over_Year_2024.py | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 The attainments and realizations of my dreams/Road safety/Year_over_Year_2024.py diff --git a/The attainments and realizations of my dreams/Road safety/Year_over_Year_2024.py b/The attainments and realizations of my dreams/Road safety/Year_over_Year_2024.py new file mode 100644 index 00000000..fdcba968 --- /dev/null +++ b/The attainments and realizations of my dreams/Road safety/Year_over_Year_2024.py @@ -0,0 +1,125 @@ +import matplotlib.colors as colour +import matplotlib.patheffects as path_effects +import matplotlib.pyplot as plt +import pandas as pd + +administrative_duty = ["Taipei", "New Taipei", "Taoyuan", "Taichung", "Tainan", "Kaohsiung"] + +year = ["2009", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"] + +death = [[133, 254, 198, 318, 340, 402], # 2009 + [152, 255, 227, 373, 319, 388], # 2010 + [140, 264, 195, 382, 346, 373], # 2011 + [130, 252, 195, 370, 288, 417], # 2012 + [140, 223, 191, 308, 311, 375], # 2013 + [138, 219, 221, 302, 290, 387], # 2014 + [137, 212, 203, 275, 289, 364], # 2015 + [157, 266, 203, 259, 269, 329], # 2016 + [106, 256, 213, 217, 246, 289], # 2017 + [137, 248, 244, 245, 289, 280], # 2018 + [131, 225, 249, 270, 294, 351], # 2019 + [102, 232, 264, 325, 317, 347], # 2020 + [132, 266, 269, 283, 295, 333], # 2021 + [107, 307, 263, 308, 312, 373], # 2022 + [109, 264, 248, 315, 296, 317], # 2023 + [119, 269, 287, 288, 277, 311], #2024 + ] + +df = pd.DataFrame(data=death, columns=administrative_duty, index=year) + +print(df) + +Taipei = df.loc[:, "Taipei"].to_numpy() + +print(Taipei) + +New_Taipei = df.loc[:, "New Taipei"].to_numpy() +Taoyuan = df.loc[:, "Taoyuan"].to_numpy() +Taichung = df.loc[:, "Taichung"].to_numpy() +Tainan = df.loc[:, "Tainan"].to_numpy() +Kaohsiung = df.loc[:, "Kaohsiung"].to_numpy() + +summary = [df["Taipei"].sum(), df["New Taipei"].sum(), df["Taoyuan"].sum(), df["Taichung"].sum(), + df["Tainan"].sum(), df["Kaohsiung"].sum()] + +print(summary) + +cumulative_sum = pd.DataFrame(data=summary, + columns=["Accumulative Deaths (2009-2023)"], + index=administrative_duty) + +print(cumulative_sum) + +figure, (axes1, axes2, axes3) = plt.subplots(3, figsize=(9, 9)) + +axes1.plot(year, Taipei, label="Taipei") +axes1.plot(year, New_Taipei, label="New Taipei") +axes1.plot(year, Taoyuan, label="Taoyuan") +axes1.plot(year, Taichung, label="Taichung") +axes1.plot(year, Tainan, label="Tainan") +axes1.plot(year, Kaohsiung, label="Kaohsiung") + +axes1.set_title("The Number of Deaths in Road Accident in Taiwan by Region") +axes1.set_xlabel("Year") +axes1.set_ylabel("The number of deaths") + +# If a 4-tuple or BboxBase is given, then it specifies the bbox (x, y, width, height) that the legend is placed in.[6] +axes1.legend() # [5][6] + +axes1.grid(True) + +# hide axes +# axes[0, 1].patch.set_visible(False) +axes2.axis('off') +axes2.axis('tight') + +table = axes2.table(cellText=cumulative_sum.values, # matplotlib table size [3] + colLabels=cumulative_sum.columns, + colColours=[colour.CSS4_COLORS.get('springgreen')], + colWidths=[0.4, 0.4, 0.4, 0.4, 0.4, 0.4], + cellColours=['w', 'w', 'w', 'w', 'w', 'w'], + cellLoc='center', + rowLabels=cumulative_sum.index, + rowColours=[colour.CSS4_COLORS.get('lightskyblue'), + colour.CSS4_COLORS.get('lightskyblue'), + colour.CSS4_COLORS.get('lightskyblue'), + colour.CSS4_COLORS.get('lightskyblue'), + colour.CSS4_COLORS.get('lightskyblue'), + colour.CSS4_COLORS.get('lightskyblue')], + loc='center', + url='Reference:\nhttps://roadsafety.tw/Dashboard/Custom?type=30日死亡人數' + ) + +# Scale column widths by xscale and row heights by yscale.[4] +table.scale(2.01, 1.57) # [3] +table.set_fontsize(14) # [3] + +axes3.bar(administrative_duty, summary, color=colour.CSS4_COLORS.get('palegreen'), linewidth=1, ecolor=colour.CSS4_COLORS.get('dodgerblue')) # Create a bar chart and its format. [7][11][12] +axes3.bar_label(axes3.containers[0], label_type='edge', color='r', fontsize=14)# Add a bar label and its format.[9][10] +axes3.plot(administrative_duty, summary, '-o', color='orange') # Add a trend line.[8] + +# matplotlib text [1][2] +text = figure.text(0.5, 0.04, + 'Reference:https://roadsafety.tw/Dashboard/Custom?type=30日死亡人數', + horizontalalignment='center', + verticalalignment='center', + size=13, + fontproperties='MS Gothic') + +text.set_path_effects([path_effects.Normal()]) + +plt.show() + +# References: +# 1. https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.text.html +# 2. https://matplotlib.org/stable/tutorials/advanced/patheffects_guide.html#sphx-glr-tutorials-advanced-patheffects-guide-py +# 3. https://stackoverflow.com/a/65763793/ +# 4. https://matplotlib.org/stable/api/table_api.html#matplotlib.table.Table.scale +# 5. https://matplotlib.org/stable/gallery/pie_and_polar_charts/pie_and_donut_labels.html#sphx-glr-gallery-pie-and-polar-charts-pie-and-donut-labels-py +# 6. https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.legend.html#matplotlib.axes.Axes.legend +# 7. https://matplotlib.org/stable/gallery/ticks_and_spines/custom_ticker1.html#sphx-glr-gallery-ticks-and-spines-custom-ticker1-py +# 8. https://stackoverflow.com/a/48842891 +# 9. https://stackoverflow.com/a/67561982/ +# 10. https://matplotlib.org/stable/gallery/lines_bars_and_markers/bar_label_demo.html +# 11. https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.bar.html#matplotlib.axes.Axes.bar +# 12. https://matplotlib.org/stable/gallery/color/named_colors.html From e9ec8639e7f9ad9c3736ebb8652161303a816114 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Mon, 11 May 2026 21:07:50 +0800 Subject: [PATCH 13/16] Committed on or around 2026/5/11 --- .../Road safety/Year_over_Year_2024.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/The attainments and realizations of my dreams/Road safety/Year_over_Year_2024.py b/The attainments and realizations of my dreams/Road safety/Year_over_Year_2024.py index fdcba968..26e50f01 100644 --- a/The attainments and realizations of my dreams/Road safety/Year_over_Year_2024.py +++ b/The attainments and realizations of my dreams/Road safety/Year_over_Year_2024.py @@ -22,7 +22,7 @@ [132, 266, 269, 283, 295, 333], # 2021 [107, 307, 263, 308, 312, 373], # 2022 [109, 264, 248, 315, 296, 317], # 2023 - [119, 269, 287, 288, 277, 311], #2024 + [119, 269, 287, 288, 277, 311], # 2024 ] df = pd.DataFrame(data=death, columns=administrative_duty, index=year) From 7262d81fe90861b81d590caf06a0e30651a321a0 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Mon, 11 May 2026 21:09:53 +0800 Subject: [PATCH 14/16] Committed on or around 2026/5/11 --- .../Road safety/Year_over_Year_2024.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/The attainments and realizations of my dreams/Road safety/Year_over_Year_2024.py b/The attainments and realizations of my dreams/Road safety/Year_over_Year_2024.py index 26e50f01..357f5543 100644 --- a/The attainments and realizations of my dreams/Road safety/Year_over_Year_2024.py +++ b/The attainments and realizations of my dreams/Road safety/Year_over_Year_2024.py @@ -5,7 +5,7 @@ administrative_duty = ["Taipei", "New Taipei", "Taoyuan", "Taichung", "Tainan", "Kaohsiung"] -year = ["2009", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"] +year = ["2009", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24"] death = [[133, 254, 198, 318, 340, 402], # 2009 [152, 255, 227, 373, 319, 388], # 2010 @@ -45,7 +45,7 @@ print(summary) cumulative_sum = pd.DataFrame(data=summary, - columns=["Accumulative Deaths (2009-2023)"], + columns=["Accumulative Deaths (2009-2024)"], index=administrative_duty) print(cumulative_sum) From e7135738c4cd66b65a869f08c63602a83c0f0f73 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Mon, 11 May 2026 21:11:10 +0800 Subject: [PATCH 15/16] Committed on or around 2026/5/11 --- .../Road safety/Year_over_Year_2025.py | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 The attainments and realizations of my dreams/Road safety/Year_over_Year_2025.py diff --git a/The attainments and realizations of my dreams/Road safety/Year_over_Year_2025.py b/The attainments and realizations of my dreams/Road safety/Year_over_Year_2025.py new file mode 100644 index 00000000..357f5543 --- /dev/null +++ b/The attainments and realizations of my dreams/Road safety/Year_over_Year_2025.py @@ -0,0 +1,125 @@ +import matplotlib.colors as colour +import matplotlib.patheffects as path_effects +import matplotlib.pyplot as plt +import pandas as pd + +administrative_duty = ["Taipei", "New Taipei", "Taoyuan", "Taichung", "Tainan", "Kaohsiung"] + +year = ["2009", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24"] + +death = [[133, 254, 198, 318, 340, 402], # 2009 + [152, 255, 227, 373, 319, 388], # 2010 + [140, 264, 195, 382, 346, 373], # 2011 + [130, 252, 195, 370, 288, 417], # 2012 + [140, 223, 191, 308, 311, 375], # 2013 + [138, 219, 221, 302, 290, 387], # 2014 + [137, 212, 203, 275, 289, 364], # 2015 + [157, 266, 203, 259, 269, 329], # 2016 + [106, 256, 213, 217, 246, 289], # 2017 + [137, 248, 244, 245, 289, 280], # 2018 + [131, 225, 249, 270, 294, 351], # 2019 + [102, 232, 264, 325, 317, 347], # 2020 + [132, 266, 269, 283, 295, 333], # 2021 + [107, 307, 263, 308, 312, 373], # 2022 + [109, 264, 248, 315, 296, 317], # 2023 + [119, 269, 287, 288, 277, 311], # 2024 + ] + +df = pd.DataFrame(data=death, columns=administrative_duty, index=year) + +print(df) + +Taipei = df.loc[:, "Taipei"].to_numpy() + +print(Taipei) + +New_Taipei = df.loc[:, "New Taipei"].to_numpy() +Taoyuan = df.loc[:, "Taoyuan"].to_numpy() +Taichung = df.loc[:, "Taichung"].to_numpy() +Tainan = df.loc[:, "Tainan"].to_numpy() +Kaohsiung = df.loc[:, "Kaohsiung"].to_numpy() + +summary = [df["Taipei"].sum(), df["New Taipei"].sum(), df["Taoyuan"].sum(), df["Taichung"].sum(), + df["Tainan"].sum(), df["Kaohsiung"].sum()] + +print(summary) + +cumulative_sum = pd.DataFrame(data=summary, + columns=["Accumulative Deaths (2009-2024)"], + index=administrative_duty) + +print(cumulative_sum) + +figure, (axes1, axes2, axes3) = plt.subplots(3, figsize=(9, 9)) + +axes1.plot(year, Taipei, label="Taipei") +axes1.plot(year, New_Taipei, label="New Taipei") +axes1.plot(year, Taoyuan, label="Taoyuan") +axes1.plot(year, Taichung, label="Taichung") +axes1.plot(year, Tainan, label="Tainan") +axes1.plot(year, Kaohsiung, label="Kaohsiung") + +axes1.set_title("The Number of Deaths in Road Accident in Taiwan by Region") +axes1.set_xlabel("Year") +axes1.set_ylabel("The number of deaths") + +# If a 4-tuple or BboxBase is given, then it specifies the bbox (x, y, width, height) that the legend is placed in.[6] +axes1.legend() # [5][6] + +axes1.grid(True) + +# hide axes +# axes[0, 1].patch.set_visible(False) +axes2.axis('off') +axes2.axis('tight') + +table = axes2.table(cellText=cumulative_sum.values, # matplotlib table size [3] + colLabels=cumulative_sum.columns, + colColours=[colour.CSS4_COLORS.get('springgreen')], + colWidths=[0.4, 0.4, 0.4, 0.4, 0.4, 0.4], + cellColours=['w', 'w', 'w', 'w', 'w', 'w'], + cellLoc='center', + rowLabels=cumulative_sum.index, + rowColours=[colour.CSS4_COLORS.get('lightskyblue'), + colour.CSS4_COLORS.get('lightskyblue'), + colour.CSS4_COLORS.get('lightskyblue'), + colour.CSS4_COLORS.get('lightskyblue'), + colour.CSS4_COLORS.get('lightskyblue'), + colour.CSS4_COLORS.get('lightskyblue')], + loc='center', + url='Reference:\nhttps://roadsafety.tw/Dashboard/Custom?type=30日死亡人數' + ) + +# Scale column widths by xscale and row heights by yscale.[4] +table.scale(2.01, 1.57) # [3] +table.set_fontsize(14) # [3] + +axes3.bar(administrative_duty, summary, color=colour.CSS4_COLORS.get('palegreen'), linewidth=1, ecolor=colour.CSS4_COLORS.get('dodgerblue')) # Create a bar chart and its format. [7][11][12] +axes3.bar_label(axes3.containers[0], label_type='edge', color='r', fontsize=14)# Add a bar label and its format.[9][10] +axes3.plot(administrative_duty, summary, '-o', color='orange') # Add a trend line.[8] + +# matplotlib text [1][2] +text = figure.text(0.5, 0.04, + 'Reference:https://roadsafety.tw/Dashboard/Custom?type=30日死亡人數', + horizontalalignment='center', + verticalalignment='center', + size=13, + fontproperties='MS Gothic') + +text.set_path_effects([path_effects.Normal()]) + +plt.show() + +# References: +# 1. https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.text.html +# 2. https://matplotlib.org/stable/tutorials/advanced/patheffects_guide.html#sphx-glr-tutorials-advanced-patheffects-guide-py +# 3. https://stackoverflow.com/a/65763793/ +# 4. https://matplotlib.org/stable/api/table_api.html#matplotlib.table.Table.scale +# 5. https://matplotlib.org/stable/gallery/pie_and_polar_charts/pie_and_donut_labels.html#sphx-glr-gallery-pie-and-polar-charts-pie-and-donut-labels-py +# 6. https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.legend.html#matplotlib.axes.Axes.legend +# 7. https://matplotlib.org/stable/gallery/ticks_and_spines/custom_ticker1.html#sphx-glr-gallery-ticks-and-spines-custom-ticker1-py +# 8. https://stackoverflow.com/a/48842891 +# 9. https://stackoverflow.com/a/67561982/ +# 10. https://matplotlib.org/stable/gallery/lines_bars_and_markers/bar_label_demo.html +# 11. https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.bar.html#matplotlib.axes.Axes.bar +# 12. https://matplotlib.org/stable/gallery/color/named_colors.html From a9f81b4c7b771737a024a2a1bc6124af2e62d606 Mon Sep 17 00:00:00 2001 From: Ceiling_roof <48134466+ResilientSpring@users.noreply.github.com> Date: Mon, 11 May 2026 21:13:47 +0800 Subject: [PATCH 16/16] Committed on or around 2026/5/11 --- .../Road safety/Year_over_Year_2025.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/The attainments and realizations of my dreams/Road safety/Year_over_Year_2025.py b/The attainments and realizations of my dreams/Road safety/Year_over_Year_2025.py index 357f5543..dcb7eb20 100644 --- a/The attainments and realizations of my dreams/Road safety/Year_over_Year_2025.py +++ b/The attainments and realizations of my dreams/Road safety/Year_over_Year_2025.py @@ -5,7 +5,7 @@ administrative_duty = ["Taipei", "New Taipei", "Taoyuan", "Taichung", "Tainan", "Kaohsiung"] -year = ["2009", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24"] +year = ["2009", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25"] death = [[133, 254, 198, 318, 340, 402], # 2009 [152, 255, 227, 373, 319, 388], # 2010 @@ -23,6 +23,7 @@ [107, 307, 263, 308, 312, 373], # 2022 [109, 264, 248, 315, 296, 317], # 2023 [119, 269, 287, 288, 277, 311], # 2024 + [114, 278, 241, 291, 304, 307], # 2025 ] df = pd.DataFrame(data=death, columns=administrative_duty, index=year) @@ -45,7 +46,7 @@ print(summary) cumulative_sum = pd.DataFrame(data=summary, - columns=["Accumulative Deaths (2009-2024)"], + columns=["Accumulative Deaths (2009-2025)"], index=administrative_duty) print(cumulative_sum)