ÎncepețiÎncepe gratuit

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.

Acest exercițiu face parte din cursul

Building Recommendation Engines in Python

Vezi cursul

Exercițiu interactiv practic

Încearcă acest exercițiu completând acest cod de exemplu.

# Inspect the first 5 rows of user_ratings
print(user_ratings.____)
Editează și rulează codul