上传文件至 q4/q4_3a
This commit is contained in:
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)
|
||||||
Reference in New Issue
Block a user