我想将john的课程替换为6A 我有此数据(融化了):
Name Class
John 5A .....
John 5A .....
Mary 6A .....
Mary 6A .....
这是我想要的结果:
Name Class
John 6A .....
John 6A .....
Mary 6A .....
Mary 6A .....
这是我尝试过的代码:
<line for melt function>
if 'John' in df['Name']:
df['Class'] = '6A'