From 38bb8142cf1838646a207ce08597bdb05c86cc75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=A5=A0=E6=A5=A0?= <2509165032@student.example.com> Date: Tue, 23 Jun 2026 11:14:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20q4/q4=5F3a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- q4/q4_3a/q4_3.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 q4/q4_3a/q4_3.py diff --git a/q4/q4_3a/q4_3.py b/q4/q4_3a/q4_3.py new file mode 100644 index 0000000..ec10f16 --- /dev/null +++ b/q4/q4_3a/q4_3.py @@ -0,0 +1,12 @@ +import json +import matplotlib.pyplot as plt + +with open("../q2_1_crawler/movies.json","r",encoding="utf-8") as f: + data = json.load(f) +movies = data["movies"] + +ratings = [i["rating"] for i in movies] +plt.hist(ratings,edgecolor="black") +plt.xlabel("评分") +plt.savefig("q4_3a_hist.png",dpi=150) +plt.close() \ No newline at end of file