Get startedGet started for free

Improved non-personalized recommendations

Just because a movie has been watched by a lot of people doesn't necessarily mean viewers enjoyed it. To understand how a viewer actually felt about a movie, more explicit data is useful. Thankfully, you also have ratings from each of the viewers in the Movie Lens dataset.

In this exercise, you will find the average rating of each movie in the dataset, and then find the movie with the highest average rating.

You will use the same user_ratings_df as you used in the previous exercise, which has been loaded for you.

This exercise is part of the course

Building Recommendation Engines in Python

View Course

Exercise instructions

  • Find the average rating for each of the movies and store it as a DataFrame called average_rating_df.
  • Sort the average_rating_df DataFrame by the average rating column from highest to lowest and store it as sorted_average_ratings.
  • Print the entries for the top five highest ranked movies in sorted_average_ratings.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Find the mean of the ratings given to each title
average_rating_df = user_ratings_df[["title", "rating"]].____('title').____()

# Order the entries by highest average rating to lowest
sorted_average_ratings = average_rating_df.____(____=____, ____=____)

# Inspect the top movies
print(____.____())
Edit and Run Code