You are using a VB Script language Label expression. Python has no Then with an if statement or Function/End Function syntax. For python you have to use == to mean equals in an if statement. A single = assigns a value only in python, which cannot be done here. The Expression that will work for Python is:
def FindLabel ([Contour], [Index]):
if int([Index]) == 1:
return [Contour]
else:
return ""
You have to convert Index to an Int, because the Label parser automatically converts all field values to string, since only strings make valid labels. Otherwise numeric fields and date fields would throw errors unless you explicitly converted them to string. So you have to convert back to int or flt to make numbers behave like numbers. Alternatively, this will work:
def FindLabel ([Contour], [Index]):
if [Index] == '1':
return [Contour]
else:
return ""
For VB Script it would be:
Function FindLabel ([Contour], [Index])
If cint([Index]) = 1 Then
FindLabel = [Contour]
Else
FindLabel = ""
End If
End Function