6 ms·
I am distracted with the example provided in the post. I am pretty sure that most pandas users will just put course_ids on the columns. I mean the shape of the
by armanboyaci 5y ago
I am distracted with the example provided in the post. I am pretty sure that most pandas users will just put course_ids on the columns. I mean the shape of the user_courses dataframe is not suitable for the task.
(user_courses
.set_index(["student_id",
"course_id"])
.unstack()
.apply(lambda x: x+1))