Having a dataframe as below
df1 = pd.DataFrame({'Name1':['A','B','A','B','B','C','C','C','E','E','E'],
'Name2':['A','B','D','C','D','D','A','B','A','B','C'],'Marks2':['Nan','Nan',6,50, 88,'Nan',140,9,'Nan',65,70]})
df1
if Name1 and Name2 are equal, then need to replace Marks2 with 0.The rest of the values need to be same.