3
This commit is contained in:
16
q4/q4_3b/q4_3b.py
Normal file
16
q4/q4_3b/q4_3b.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import json
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
plt.rcParams['font.sans-serif'] = ['SimHei']
|
||||
plt.rcParams['axes.unicode_minus'] = False
|
||||
|
||||
with open('simulated-examination/q2_1_crawler/movies.json', 'r', encoding='utf-8') as f:
|
||||
movies = json.load(f)
|
||||
|
||||
durations = [m['duration'] for m in movies]
|
||||
|
||||
plt.figure()
|
||||
plt.hist(durations, bins=5, color='green')
|
||||
plt.title("时长分布")
|
||||
plt.xlabel("时长(分钟)")
|
||||
plt.savefig('q4_3b_hist.png', dpi=150)
|
||||
Reference in New Issue
Block a user