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 IDtitle
: Title of the movierating
: 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.
This exercise is part of the course
Building Recommendation Engines in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Inspect the first 5 rows of user_ratings
print(user_ratings.____)