forked from 2509165022/simulated-examination
提交
This commit is contained in:
105
q4/q4_3a/movies.json
Normal file
105
q4/q4_3a/movies.json
Normal file
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
14
q4/q4_3a/q4_3a.py
Normal file
14
q4/q4_3a/q4_3a.py
Normal file
@@ -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)
|
||||
BIN
q4/q4_3a/q4_3a_hist.png
Normal file
BIN
q4/q4_3a/q4_3a_hist.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Reference in New Issue
Block a user