I have a CSV file that has 9 columns, the last one is a column of a list of features as following:
First Name Last Name Email Grad Date Major List Appointments Count Advising Time Labels Count Labels Name List
0 Adrien Yanez ayaneza@twitter.com NaN Psychology: Neuroscience 12 325 18 acad_stat=gr, class_code=sr, sess=fa, re_id=11...
1 Aindrea Braams abraams3v@nps.gov NaN Psychology: Neuroscience 4 120 17 cx_id=600852, re_id=1114446, primary_departmen...
2 Alida Swinburne aswinburne52@cyberchimps.com 5/1/2022 Psychology 1 30 14 re_id=1124407, primary_department=psychology, ...
The column Labels Name List is the target one, the objective is to create new columns each has a name of one of the tags or features inside the list, and the value is the value after the '=' sign after the tag name in the list, or takes the value of 1 if there is no '=' sign.
For example, if the tag list for row 1 is:
adv1=syed ahmad, cx_id=616758, re_id=1112539, slate_id=, class_session=spring, class_yr=2018, advd=joseph atkins, adv2=, not labeled seniors 2022
The output will look like this:
adv1 cx_id re_id slate_id class_session class_yr advd adv2 not labeled seniors 2022
0 syed admad 616758 1112539 1 spring 2018 joseph atkins 1 1
so how can I do that in pandas, please?
Note: The total columns will be a fixed number of course for all rows, which means if a row doesn't have the tag name it will take the value of none or 0 in this tag column