diff --git a/q4/q4_1/q4_1.py b/q4/q4_1/q4_1.py new file mode 100644 index 0000000..aed5034 --- /dev/null +++ b/q4/q4_1/q4_1.py @@ -0,0 +1,19 @@ +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"] + +genre_cnt = {} +for m in movies: + g = m["genre"] + genre_cnt[g] = genre_cnt.get(g,0)+1 + +x = list(genre_cnt.keys()) +y = list(genre_cnt.values()) + +plt.bar(x,y) +plt.tight_layout() +plt.savefig("q4_1_bar.png",dpi=150) +plt.close() \ No newline at end of file