The file movies.zip contains two data files: movies.csv and ratings.csv. Write a function named selected_movie_ratings that accepts three arguments: a file containing movie names, a file containing movie ratings, and a list of movies. Return a pandas Series containing the count of ratings at each level (in .5-star increments). Order your series such that the highest ratings (5 stars) appear at the top of the list. Your function must use NumPy and/or pandas functionality to calculate the result, with no loops or list comprehensions. My solution does not use pandas’s merge functionality, but you may use merge if you find it helpful. merge was covered in your reading, but not in class. Assume the movies in the input list will be rendered correctly in terms of spelling, capitalization, etc. In other words, we will only test with correct movie titles that appear in the movies.csv file. You may submit your solution either as a .py file or as a Jupyter Notebook (.ipynb) Examples Such a function might be useful in analyzing the overall reception of a movie franchise such as the Mission: Impossible series: In [1]: m_list = [‘Mission: Impossible (1996)’, ‘Mission: Impossible II (2000)’, ‘Mission: Impossible III (2006)’, ‘Mission: Impossible – Ghost Protocol (2011)’, ‘Mission: Impossible – Rogue Nation (2015)’, ‘Mission: Impossible – Fallout (2018)’] In [2]: selected_movie_ratings(‘movies.csv’, ‘ratings.csv’, m_list) Out[2]: rating 5.0 5535 4.5 3744 4.0 18954 3.5 10509 3.0 19749 2.5 4514 2.0 5635 1.5 1323 1.0 2076 0.5 1053 Name: count, dtype: int64 …or the Harry Potter franchise: In [1]: m_list = [‘Harry Potter and the Chamber of Secrets (2002)’, ‘Harry Potter and the Prisoner of Azkaban (2004)’, ‘Harry Potter and the Goblet of Fire (2005)’, ‘Harry Potter and the Order of the Phoenix (2007)’, ‘Harry Potter and the Half-Blood Prince (2009)’, ‘Harry Potter and the Deathly Hallows: Part 1 (2010)’, ‘Harry Potter and the Deathly Hallows: Part 2 (2011)’] In [2]: selected_movie_ratings(‘movies.csv’, ‘ratings.csv’, m_list) Out[2]: rating 5.0 23120 4.5 15396 4.0 32351 3.5 19282 3.0 15119 2.5 5143 2.0 3834 1.5 1375 1.0 1807 0.5 2041 Name: count, dtype: int64
Blog
Match the example of human artwork to its purpose as discuss…
Match the example of human artwork to its purpose as discussed in class.
Suppose df is a DataFrame with a column “Final”. What does t…
Suppose df is a DataFrame with a column “Final”. What does the following code return? df[“Final”].mean()
What is NOT something we understand about diets at the villa…
What is NOT something we understand about diets at the village site at Arbon-Bleiche 3 in Switzerland?
Which aspect of social inequality is frequently ignored in t…
Which aspect of social inequality is frequently ignored in the social construction of illness, as seen with both HIV and obesity?
Which of these refers to a theory that analyzes how systems…
Which of these refers to a theory that analyzes how systems within a particular culture, including health care systems, affect one’s worldview and actions?
Which of these IS true about the different cultural approach…
Which of these IS true about the different cultural approaches to schizophrenia we discussed in class?
Which of these is NOT a feature of anthropology that has val…
Which of these is NOT a feature of anthropology that has value in business?
The domestication of which animals significantly impacted hu…
The domestication of which animals significantly impacted human lifestyles?
Which of these is NOT something we have evidence for at El S…
Which of these is NOT something we have evidence for at El Sidron in Spain?