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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -