Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df = pd.read_csv('ratings.csv', sep=',')
- df_id = pd.read_csv('links.csv', sep=',')
- df = pd.merge(df, df_id, on=['movieId'])
- rating_matrix = np.zeros((df.userId.unique().shape[0], max(df.movieId)))
- for row in df.itertuples():
- rating_matrix[row[1]-1, row[2]-1] = row[3]
- rating_matrix = rating_matrix[:,:9000]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement