python - How to insert new data in pandas dataframe by referencing to a list? -
suppose i've got pandas dataframe df follow:
supervisor  student   age   dr.a        ken     19   dr.a        jay     19   dr.b        tom     20   dr.c        kay     21   and wanna add new column 'status' dataframe become:
supervisor  student   age   status   dr.a        ken     19         dr.a        jay     19         dr.b        tom     20         dr.c        kay     21         the data in 'status' referenced list profile:
['dr.a', 'jay -ken +', 'dr.b', 'tom r3', 'dr.c', 'kay']   how achieve expected output below?
supervisor  student   age   status   dr.a        ken     19      +   dr.a        jay     19      -   dr.b        tom     20      r3   dr.c        kay     21             
 
Comments
Post a Comment