1

I am using ArcGIS Pro, field calculator to add the values of two fields (Result_A and Result_B) and assign the value to new Field Combined_Result. The type for all three fields is "double". Both fields for Result_A and Result_B have some cells with null values. This is generating errors in their addition. In the Calculate Field window (for field Combined_Result) For the calculate field, I am using the following expresssion:

=!Result_A! + !Result_B!

I get the following error:

WARNING 002858: Certain rows set to NULL due to error while evaluating python expression: TypeError: unsupported operand type(s) for +: 'float' and 'NoneType'

I have tried changing the fields to float but get the same error.

Should I convert null values to zero before running the expression?

I have beginner's level python skills and can set up a code to convert null values if you point me in the right direction.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Dec 9, 2020 at 20:19

1 Answer 1

1

I did not have to convert the null value cells to zero. Instead I wrote the following code block in the "Calculate Field" window for Combined_Result

= ((!Result_A! or 0) + (!Result_B! or 0))
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
answered Dec 9, 2020 at 20:40

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.