0

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?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Feb 2, 2022 at 21:23

1 Answer 1

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.

answered Feb 2, 2022 at 21:26

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.