Python programming Problem 1. Top Movies and Actors This problem is about analyz
ID: 3863389 • Letter: P
Question
Python programming
Problem 1. Top Movies and Actors This problem is about analyzing data from IMDB lists with top rated and top grossing movies. There are these files linked from the Homework 4 Canvas page: imdb-top-rated.csv, listing the ranking of the top rated 250 movies. It has this format: Rank, Title, Year IMDB Rating imdb-top-grossing.csv, listing the ranking of the highest grossing 250 movies. It has this format: Rank,Title, Year,USA Box Office imdb-top-casts.csv, listing the director and cast for the movies in the above files. It has this format: Title, Director, Actor 1, Actor 2,Actor 3,Actor 4, Actor 5. The actors are listed in billing order. This file does not have a heading. These files are from Duke U. and seem to date from 2014.Explanation / Answer
Solution:
a)
import csv
Rank=[]
Title=[]
Year=[]
Rating=[]
Rating1=[]
Ran=[]
Dir=[]
with open('imdb-top-rated.csv') as fil:
reader = csv.reader(fil)
for current in reader:
Rank.append(int(current[0]))
Title.append(current[1])
Year.append(int(current[2]))
Rating.append(float(current[3]))
print(Rating)
with open('imdb-top-casted.csv') as fil1:
reader = csv.reader(fil)
for curr in reader:
j=0
for tit in Title:
if curr[0]==tit:
Ran.append(Rank[j])
Dir.append(curr[1])
from collections import Counter
print(sorted(Ran, key=Counter(Ran).get, reverse=True))
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.