Session Ready
Exercise

Finding all pairs of movies

In this exercise, you will work through how to find all pairs of movies or all permutations of pairs of movies that have been watched by the same person.

The user_ratings_df has been loaded once again containing users, and the movies they have seen.

You will need to first create a function that finds all possible pairs of items in a list it is applied to. For ease of use, you will output the values of this as a DataFrame. Since you only want to find movies that have been seen by the same person and not all possible permutations, you will group by user_id when applying the function.

Instructions 1/2
undefined XP
  • 1
  • 2
  • Create a function called find_movie_pairs that finds all permutations of a Series, and stores the results as a DataFrame.
  • Apply this function to the user_ratings_df DataFrame and print the results.