I find the result is a little bit random. Sometimes it's a copy sometimes it's a view. For example:
df = pd.DataFrame([{'name':'Marry', 'age':21},{'name':'John','age':24}],index=['student1','student2'])
df
age name
student1 21 Marry
student2 24 John
Now, Let me try to modify it a little bit.
df2= df.loc['student1']
df2 [0] = 23
df
age name
student1 21 Marry
student2 24 John
As you can see, nothing changed. df2 is a copy. However, if I add another student into the dataframe...
df.loc['student3'] = ['old','Tom']
df
age name
student1 21 Marry
student2 24 John
student3 old Tom
Try to change the age again..
df3=df.loc['student1']
df3[0]=33
df
age name
student1 33 Marry
student2 24 John
student3 old Tom
Now df3 suddenly became a view. What is going on? I guess the value 'old' is the key?