12 lines
319 B
Python
12 lines
319 B
Python
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() |