I have a question regarding the loc function for my pandas DataFrame.
First I want to check if the person is a student, then I would like to assign to first value of the list 'Course' for that specific student. The dataset is quite large so I would like to keep using the loc function.
import pandas as pd
df = pd.DataFrame([{'Person':'student 1', 'Course':['course 1']}, {'Person':'student 2','Course':['course 1', 'course 2']}, {'Person':'teacher 1','Course':['course 1', 'course 2']}])
print(df)
df.loc[df['c1'].str.contains('student'), 'main student course'] = #first element of the list in 'Course' column.
How can I do this?