Get startedGet started for free

Making your first movie recommendations

Now that you have found the most commonly paired movies, you can make your first recommendations!

While you are not taking in any information about the person watching, and do not even know any details about the movie, valuable recommendations can still be made by examining what groups of movies are watched by the same people. In this exercise, you will examine the movies often watched by the same people that watched Thor, and then use this data to give a recommendation to someone who just watched the movie. The DataFrame you generated in the last lesson, combination_counts_df, that contains counts of how often movies are watched together has been loaded for you.

This exercise is part of the course

Building Recommendation Engines in Python

View Course

Exercise instructions

  • Order the combination_counts_df object from largest to smallest by the size column.
  • Find the newly ordered movie frequencies for the movie Thor by subsetting the ordered combination_counts_df object where movie_a is Thor assign them to thor_df and plot the results.

Hands-on interactive exercise

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

import matplotlib.pyplot as plt

# Sort the counts from highest to lowest
combination_counts_df.____('size', ascending=____, inplace=____)

# Find the movies most frequently watched by people who watched Thor
thor_df = ____[____['movie_a'] ____ 'Thor']

# Plot the results
thor_df.plot.bar(x="movie_b")
plt.show()
Edit and Run Code