I have a data frame looks like
userId movieId rating
0 12882 1 4.0
1 12882 32 3.5
2 12882 47 5.0
3 12882 50 5.0
4 12882 110 4.5
But I want to convert it into a matrix which the rowname is userId, column name is movieId and the value is the rating.
1 32 47
12882 4.0 3.5 5.0
I have try to use the groupby, but after that, I have no idea how to convert it.
test = Ratings[['userId','movieId','rating']]
test_group = test.groupby(['userId','movieId'],as_index=False,sort=False)