1

I have created a new field to calculate the average of 3 other fields in a table where nulls are present. Using python as the parser(with no code block) I used this:

(!Slope_PCT! or 0 + !Flood_PCT! or 0 + !Wetland_PCT! or 0)/3

I get results but some of them are not correct.

2
  • How are you handling null values in your analysis? Are they actually 0, or do they really represent NoData? This could significantly change how you would want to run your analysis.
    – Aaron
    Commented May 21, 2014 at 13:25
  • 1
    In this case where there is nodata(null) we assume the value to be 0.
    – its30
    Commented May 21, 2014 at 13:28

1 Answer 1

2

Looks like I needed to add parens around each 'or' statement:

((!Slope_PCT! or 0) + (!Flood_PCT! or 0) + (!Wetland_PCT! or 0))/3

Your Answer

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

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