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?

1
  • FYI quite often I will check the help file right from the field calculator for small syntax/formatting and function references. Commented Jun 9, 2016 at 14:17

1 Answer 1

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!)
0

Your Answer

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.