2

I am just starting with Python and ArcGIs so here is my question:

I have the column "DB_Low" (Type "Long") and want to fill a new column by changing values. The new column will be a Float-Type field.

So here is what I tried so far:

if !DB_Low! == 0:

  return 0

else:

  return  !DB_Low! + 2.25

But I get the Error: 000539 SyntaxError, invalid syntax (, line 1)

Can someone tell me the mistake in my code?

  • FYI quite often I will check the help file right from the field calculator for small syntax/formatting and function references. – Barrett Jun 9 '16 at 14:17
2

In the code block window of the field calculator, try using:

def new(DB_Low):
    if DB_Low == 0:
        return 0
    else:
        return DB_Low + 2.25

And then in the expression window:

new(!DB_Low!)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.