July 2018
Beginner to intermediate
146 pages
3h 39m
English
As mentioned in the previous section, we are only interested in three files in the movielens folder: u.data, u.user, and u.item. Although these files are not in CSV format, the code required to load them into a Pandas DataFrame is almost identical.
Let's start with u.user:
#Load the u.user file into a dataframeu_cols = ['user_id', 'age', 'sex', 'occupation', 'zip_code']users = pd.read_csv('../data/movielens/u.user', sep='|', names=u_cols, encoding='latin-1')users.head()
Here is its output:

We see that the u.user file contains demographic information about our users, such as their age, sex, occupation, and zip_code.
Next, ...
Read now
Unlock full access