Hey guys I have a question for grouping rows based on a name.
Below is my dataset:
Name University Subject
John Harvard English, French
John MIT Economics
Alan BU Data Science
I would like to have the following output:
Name Harvard MIT BU English French Economics Data Science
John 1 1 0 1 1 1 0
Alan 0 0 1 0 0 0 1
Please let me know how to do this in Python. I am quite new to this, I understand that we can use one hot encoding to create binary variables but I am not sure how to merge the rows based on the same name and separate the subjects.
- How do you merge the rows based on the same name?
- How do you create separate columns as for subjects separated by ","
- How do you create binary variables for all of this after?