LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Building Recommendation Engines in Python

Kurs anzeigen

Anleitung zur Übung

  • 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.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# 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(____.____())
Code bearbeiten und ausführen