From 490f8c82f6d119511c351ddef3d0d96700ba011d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8E=AB=E5=A2=9E?= <2509165014@student.example.com> Date: Sun, 5 Jul 2026 18:02:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=201.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.py | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 1.py diff --git a/1.py b/1.py deleted file mode 100644 index dffbf6f..0000000 --- a/1.py +++ /dev/null @@ -1,19 +0,0 @@ -import json -import matplotlib.pyplot as plt - -movies = json.load(open('movies.json', encoding='utf-8'))['movies'] -# print(movies) -genres = {} -for m in movies: - g = m['genre'] - if g in genres: - genres[g] = genres[g] + 1 - else: - genres[g] = 1 -print(genres) -plt.figure(figsize=(8,5)) -plt.bar(genres.keys(), genres.values()) -plt.title('类型电影数量分布') -plt.xlabel('类型') -plt.ylabel('数量') -plt.savefig('q4_1_bar.png', dpi=150) \ No newline at end of file