Replace values of None in Field Calculator?

Discussion created by jacobne on Aug 2, 2011
Latest reply on Aug 3, 2011 by jacobne

Can't seem to figure this one out.  I'm calculating a field with the field calculator, but not every row is populated with a value. Only about half are populated and the rest of the rows are Null.  I tried to define a python function to replace the Null values with 0, but no luck so far.  It looks something like this:

#Code Block

def popNull(x):
  if x is Null:
    return 0


= popNull(!Field!)

I suppose I should have used an update cursor?  As a work around I populated the entire field with a value of 0 before doing my real calc.  That filled in the gaps, but I'd still like to figure this out.