I am trying to create a new column that combines the values of two other columns for display purposes. Here is the code that I am trying:
"Pre-Logic Script Code" window:
def reclass( !Survey1_Interest!, !Survey2_Interest!):
if(!Survey1_Interest!=="No"):
return "No"
else:
if(!Survey2_Interest!=="NO"):
return "No"
else:
return "Maybe"
"New_column_name =" window:
reclass(!Survey1_Interest!, !Survey2_Interest!)
This produces an "ERROR 000989: Python syntax error: Parsing error SyntaxError: invalid syntax (line 1)" and a "Parameters are not valid" message in the results window.
Is there a way to fix this?
1 Answer 1
Tried substituting the parameters "!Survey1_Interest!" and "!Survey2_Interest!" for more generalized ones "col1" and "col2" in the Pre-Logic script window:
def reclass( col1, col2):
if(col1=="No"):
return "No"
else:
if(col2=="NO"):
return "No"
else:
return "Maybe"
Kept other window the same:
reclass( !Survey1_Interest!, !Survey2_Interest!)
This seemed to solve the issue and the column was populated successfully.
Explore related questions
See similar questions with these tags.