diff --git a/q3/q3_3_质量自评.md b/q3/q3_3_质量自评.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/q3/q3_3_质量自评.md @@ -0,0 +1 @@ + diff --git a/q4/q4_1/movies.json b/q4/q4_1/movies.json new file mode 100644 index 0000000..20ba5dc --- /dev/null +++ b/q4/q4_1/movies.json @@ -0,0 +1,105 @@ +{ + "ID": "B-20260625-3464", + "movies": [ + { + "id": 1, + "title": "霸王别姬", + "director": "Frank Darabont", + "year": 2004, + "rating": 6.8, + "duration": 179, + "genre": "科幻", + "actors_count": 3 + }, + { + "id": 2, + "title": "放牛班的春天", + "director": "陈凯歌", + "year": 2019, + "rating": 6.7, + "duration": 117, + "genre": "喜剧", + "actors_count": 5 + }, + { + "id": 3, + "title": "泰坦尼克号", + "director": "Robert Zemeckis", + "year": 2015, + "rating": 9.1, + "duration": 177, + "genre": "爱情", + "actors_count": 4 + }, + { + "id": 4, + "title": "三傻大闹宝莱坞", + "director": "James Cameron", + "year": 2024, + "rating": 7.6, + "duration": 117, + "genre": "冒险", + "actors_count": 5 + }, + { + "id": 5, + "title": "阿甘正传", + "director": "宫崎骏", + "year": 2016, + "rating": 8.0, + "duration": 146, + "genre": "喜剧", + "actors_count": 3 + }, + { + "id": 6, + "title": "星际穿越", + "director": "Christopher Nolan", + "year": 2010, + "rating": 9.2, + "duration": 168, + "genre": "爱情", + "actors_count": 2 + }, + { + "id": 7, + "title": "忠犬八公的故事", + "director": "Lasse Hallström", + "year": 2016, + "rating": 9.3, + "duration": 106, + "genre": "悬疑", + "actors_count": 5 + }, + { + "id": 8, + "title": "肖申克的救赎", + "director": "Rajkumar Hirani", + "year": 2018, + "rating": 7.3, + "duration": 107, + "genre": "剧情", + "actors_count": 4 + }, + { + "id": 9, + "title": "千与千寻", + "director": "Christophe Barratier", + "year": 2019, + "rating": 7.3, + "duration": 118, + "genre": "动画", + "actors_count": 4 + }, + { + "id": 10, + "title": "盗梦空间", + "director": "Christopher Nolan", + "year": 2008, + "rating": 9.3, + "duration": 111, + "genre": "动画", + "actors_count": 5 + } + ] +} \ No newline at end of file diff --git a/q4/q4_1/q4_1.py b/q4/q4_1/q4_1.py new file mode 100644 index 0000000..b329ba7 --- /dev/null +++ b/q4/q4_1/q4_1.py @@ -0,0 +1,19 @@ +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 diff --git a/q4/q4_1/q4_1_bar.png b/q4/q4_1/q4_1_bar.png new file mode 100644 index 0000000..f76d00c Binary files /dev/null and b/q4/q4_1/q4_1_bar.png differ diff --git a/q4/q4_2/movies.json b/q4/q4_2/movies.json new file mode 100644 index 0000000..20ba5dc --- /dev/null +++ b/q4/q4_2/movies.json @@ -0,0 +1,105 @@ +{ + "ID": "B-20260625-3464", + "movies": [ + { + "id": 1, + "title": "霸王别姬", + "director": "Frank Darabont", + "year": 2004, + "rating": 6.8, + "duration": 179, + "genre": "科幻", + "actors_count": 3 + }, + { + "id": 2, + "title": "放牛班的春天", + "director": "陈凯歌", + "year": 2019, + "rating": 6.7, + "duration": 117, + "genre": "喜剧", + "actors_count": 5 + }, + { + "id": 3, + "title": "泰坦尼克号", + "director": "Robert Zemeckis", + "year": 2015, + "rating": 9.1, + "duration": 177, + "genre": "爱情", + "actors_count": 4 + }, + { + "id": 4, + "title": "三傻大闹宝莱坞", + "director": "James Cameron", + "year": 2024, + "rating": 7.6, + "duration": 117, + "genre": "冒险", + "actors_count": 5 + }, + { + "id": 5, + "title": "阿甘正传", + "director": "宫崎骏", + "year": 2016, + "rating": 8.0, + "duration": 146, + "genre": "喜剧", + "actors_count": 3 + }, + { + "id": 6, + "title": "星际穿越", + "director": "Christopher Nolan", + "year": 2010, + "rating": 9.2, + "duration": 168, + "genre": "爱情", + "actors_count": 2 + }, + { + "id": 7, + "title": "忠犬八公的故事", + "director": "Lasse Hallström", + "year": 2016, + "rating": 9.3, + "duration": 106, + "genre": "悬疑", + "actors_count": 5 + }, + { + "id": 8, + "title": "肖申克的救赎", + "director": "Rajkumar Hirani", + "year": 2018, + "rating": 7.3, + "duration": 107, + "genre": "剧情", + "actors_count": 4 + }, + { + "id": 9, + "title": "千与千寻", + "director": "Christophe Barratier", + "year": 2019, + "rating": 7.3, + "duration": 118, + "genre": "动画", + "actors_count": 4 + }, + { + "id": 10, + "title": "盗梦空间", + "director": "Christopher Nolan", + "year": 2008, + "rating": 9.3, + "duration": 111, + "genre": "动画", + "actors_count": 5 + } + ] +} \ No newline at end of file diff --git a/q4/q4_2/q4_2.py b/q4/q4_2/q4_2.py new file mode 100644 index 0000000..ec9d996 --- /dev/null +++ b/q4/q4_2/q4_2.py @@ -0,0 +1,17 @@ +import json +import matplotlib.pyplot as plt + +movies = json.load(open('movies.json', encoding='utf-8'))['movies'] +# print(movies) +ratings = [] +durations = [] +for m in movies: + ratings.append(m['rating']) + durations.append(m['duration']) + +plt.figure(figsize=(8,5)) +plt.scatter(durations,ratings,color='red',alpha=0.6) +plt.title('时长与评分关系散点图') +plt.xlabel('duration') +plt.ylabel('rating') +plt.savefig('q4_2_scatter.png', dpi=150) \ No newline at end of file diff --git a/q4/q4_2/q4_2_scatter.png b/q4/q4_2/q4_2_scatter.png new file mode 100644 index 0000000..97ea82b Binary files /dev/null and b/q4/q4_2/q4_2_scatter.png differ diff --git a/q4/q4_3a/movies.json b/q4/q4_3a/movies.json new file mode 100644 index 0000000..20ba5dc --- /dev/null +++ b/q4/q4_3a/movies.json @@ -0,0 +1,105 @@ +{ + "ID": "B-20260625-3464", + "movies": [ + { + "id": 1, + "title": "霸王别姬", + "director": "Frank Darabont", + "year": 2004, + "rating": 6.8, + "duration": 179, + "genre": "科幻", + "actors_count": 3 + }, + { + "id": 2, + "title": "放牛班的春天", + "director": "陈凯歌", + "year": 2019, + "rating": 6.7, + "duration": 117, + "genre": "喜剧", + "actors_count": 5 + }, + { + "id": 3, + "title": "泰坦尼克号", + "director": "Robert Zemeckis", + "year": 2015, + "rating": 9.1, + "duration": 177, + "genre": "爱情", + "actors_count": 4 + }, + { + "id": 4, + "title": "三傻大闹宝莱坞", + "director": "James Cameron", + "year": 2024, + "rating": 7.6, + "duration": 117, + "genre": "冒险", + "actors_count": 5 + }, + { + "id": 5, + "title": "阿甘正传", + "director": "宫崎骏", + "year": 2016, + "rating": 8.0, + "duration": 146, + "genre": "喜剧", + "actors_count": 3 + }, + { + "id": 6, + "title": "星际穿越", + "director": "Christopher Nolan", + "year": 2010, + "rating": 9.2, + "duration": 168, + "genre": "爱情", + "actors_count": 2 + }, + { + "id": 7, + "title": "忠犬八公的故事", + "director": "Lasse Hallström", + "year": 2016, + "rating": 9.3, + "duration": 106, + "genre": "悬疑", + "actors_count": 5 + }, + { + "id": 8, + "title": "肖申克的救赎", + "director": "Rajkumar Hirani", + "year": 2018, + "rating": 7.3, + "duration": 107, + "genre": "剧情", + "actors_count": 4 + }, + { + "id": 9, + "title": "千与千寻", + "director": "Christophe Barratier", + "year": 2019, + "rating": 7.3, + "duration": 118, + "genre": "动画", + "actors_count": 4 + }, + { + "id": 10, + "title": "盗梦空间", + "director": "Christopher Nolan", + "year": 2008, + "rating": 9.3, + "duration": 111, + "genre": "动画", + "actors_count": 5 + } + ] +} \ No newline at end of file diff --git a/q4/q4_3a/q4_3a.py b/q4/q4_3a/q4_3a.py new file mode 100644 index 0000000..ff6357c --- /dev/null +++ b/q4/q4_3a/q4_3a.py @@ -0,0 +1,14 @@ +import json +import matplotlib.pyplot as plt + +movies = json.load(open('movies.json', encoding='utf-8'))['movies'] +# print(movies) +ratings = [] +durations = [] +for m in movies: + ratings.append(m['rating']) + durations.append(m['duration']) + +plt.figure(figsize=(8,5)) +plt.hist(ratings, bins=5,color='blue') +plt.savefig('q4_3a_hist.png',dpi=150) diff --git a/q4/q4_3a/q4_3a_hist.png b/q4/q4_3a/q4_3a_hist.png new file mode 100644 index 0000000..838a99a Binary files /dev/null and b/q4/q4_3a/q4_3a_hist.png differ diff --git a/q4/q4_3b/movies.json b/q4/q4_3b/movies.json new file mode 100644 index 0000000..20ba5dc --- /dev/null +++ b/q4/q4_3b/movies.json @@ -0,0 +1,105 @@ +{ + "ID": "B-20260625-3464", + "movies": [ + { + "id": 1, + "title": "霸王别姬", + "director": "Frank Darabont", + "year": 2004, + "rating": 6.8, + "duration": 179, + "genre": "科幻", + "actors_count": 3 + }, + { + "id": 2, + "title": "放牛班的春天", + "director": "陈凯歌", + "year": 2019, + "rating": 6.7, + "duration": 117, + "genre": "喜剧", + "actors_count": 5 + }, + { + "id": 3, + "title": "泰坦尼克号", + "director": "Robert Zemeckis", + "year": 2015, + "rating": 9.1, + "duration": 177, + "genre": "爱情", + "actors_count": 4 + }, + { + "id": 4, + "title": "三傻大闹宝莱坞", + "director": "James Cameron", + "year": 2024, + "rating": 7.6, + "duration": 117, + "genre": "冒险", + "actors_count": 5 + }, + { + "id": 5, + "title": "阿甘正传", + "director": "宫崎骏", + "year": 2016, + "rating": 8.0, + "duration": 146, + "genre": "喜剧", + "actors_count": 3 + }, + { + "id": 6, + "title": "星际穿越", + "director": "Christopher Nolan", + "year": 2010, + "rating": 9.2, + "duration": 168, + "genre": "爱情", + "actors_count": 2 + }, + { + "id": 7, + "title": "忠犬八公的故事", + "director": "Lasse Hallström", + "year": 2016, + "rating": 9.3, + "duration": 106, + "genre": "悬疑", + "actors_count": 5 + }, + { + "id": 8, + "title": "肖申克的救赎", + "director": "Rajkumar Hirani", + "year": 2018, + "rating": 7.3, + "duration": 107, + "genre": "剧情", + "actors_count": 4 + }, + { + "id": 9, + "title": "千与千寻", + "director": "Christophe Barratier", + "year": 2019, + "rating": 7.3, + "duration": 118, + "genre": "动画", + "actors_count": 4 + }, + { + "id": 10, + "title": "盗梦空间", + "director": "Christopher Nolan", + "year": 2008, + "rating": 9.3, + "duration": 111, + "genre": "动画", + "actors_count": 5 + } + ] +} \ No newline at end of file diff --git a/q4/q4_3b/q4_3b.py b/q4/q4_3b/q4_3b.py new file mode 100644 index 0000000..2e12382 --- /dev/null +++ b/q4/q4_3b/q4_3b.py @@ -0,0 +1,14 @@ +import json +import matplotlib.pyplot as plt + +movies = json.load(open('movies.json', encoding='utf-8'))['movies'] +# print(movies) +ratings = [] +durations = [] +for m in movies: + ratings.append(m['rating']) + durations.append(m['duration']) + +plt.figure(figsize=(8,5)) +plt.hist(durations, bins=5,color='blue') +plt.savefig('q4_3b_hist.png',dpi=150) \ No newline at end of file diff --git a/q4/q4_3b/q4_3b_hist.png b/q4/q4_3b/q4_3b_hist.png new file mode 100644 index 0000000..6e9ef9b Binary files /dev/null and b/q4/q4_3b/q4_3b_hist.png differ