Tuesday, 15 August 2017

Unable to replace Null values using Python parser of ArcGIS 10.0 Field Calculator?


I'm using the following python code to replace Null values by 0, using field calculator:


def nulls(p1):
if p1 is None:
return 0
else:
return p1

But nothing happens, Null values stay. I'm using ArcGIS Desktop 10.0.




Answer



Since your code worked for me, a work around would be to use 'select by attribute' to select null rows e.g. MyField IS NULL. Once you have them all selected just use field calculator e.g. MyField = 0.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...