上传文件至 q4/q4_3a
This commit is contained in:
12
q4/q4_3a/q4_3.py
Normal file
12
q4/q4_3a/q4_3.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import json
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
with open("../q2_1_crawler/movies.json","r",encoding="utf-8") as f:
|
||||||
|
data = json.load(f)
|
||||||
|
movies = data["movies"]
|
||||||
|
|
||||||
|
ratings = [i["rating"] for i in movies]
|
||||||
|
plt.hist(ratings,edgecolor="black")
|
||||||
|
plt.xlabel("评分")
|
||||||
|
plt.savefig("q4_3a_hist.png",dpi=150)
|
||||||
|
plt.close()
|
||||||
Reference in New Issue
Block a user