Null value gotcha for Field Calculator in Python

I had a problem trying to do a field calculation with field values that had <Null> ‘s.  You need to convert these to strings first apparently!!  Read below!

When Calculate Field evaluates your expression, it looks for null values and if any are found, the expression is not evaluated. This prevents divide-by-zero errors and other undefined operations.

If your field contains null values, you need to turn it into a string (using str()) in the expression, even if it’s already a string field e.g


Plus, if you want to return a null value back to the cell, then just return “None” – without quotes 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s