Skip to main content
3 of 3
edited tags; edited title
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Calculating only values that are not null in field using ArcGIS Pro

I'm using ArcGIS Pro, the field calculator. I want to populate a hydrant layer with hydrant inspection data. I have two fields from a joined table: field 1 and field 2. I want to populate field 1 with the values from field 2, but only if the values ARE NOT Null. Basically I want to preserve the values in field 1 if the corresponding value in field 2 is Null. I've been trying slight variations of the python code below. But it just populates field 1 with all of field 2 whether there are nulls or not.

I'm a beginner when it comes to Python.

Codeblock:

def reclass(f1,f2):
        if f2 is not None:
            return f2
        else:
            pass

Expression:

reclass(!field1!,!field2!)
Katie B.
  • 807
  • 1
  • 7
  • 18