Session Ready
Exercise

Pivoting your data

In this chapter, you will go one step further in generating personalized recommendations — you will find items that users, similar to the one you are making recommendations for, have liked.

The first step you will need to start with is formatting your data. You begin with a dataset containing users and their ratings as individual rows with the following columns:

  • user: User ID
  • title: Title of the movie
  • rating: Rating the user gave the movie

You will need to transform the DataFrame into a user rating matrix where each row represents a user, and each column represents the movies on the platform. This will allow you to easily compare users and their preferences.

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Inspect the first five rows of the user_ratings DataFrame to observe which columns would be most appropriate to pivot the data around.