I have dataframe of the form
user_id item_id rating
1 abc 5
1 abcd 3
2 abc 3
2 fgh 5
I want to convert it into a numpy matrix such as
# abc abcd fgh
[[5, 3, 0] # user_id 1
[3, 0, 5]] # user_id 2
Can anyone help?