Skip to content

Comment on What would it take to recreate dplyr in Python? (2020)

Comments

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))
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.