FAQ: How can I check for null values in the Field Calculator using Python?
【相关信息】
Article ID: 40913
Software:
ArcGIS for Desktop Advanced 10.1
ArcGIS for Desktop Standard 10.1
ArcGIS for Desktop Basic 10.1
Platforms:
Windows XP, Server 2003, Vista, Server 2008, Windows 7, Windows 8, Server 2012
【问题描述】
How can I check for null values in the Field Calculator using Python?
Article ID: 40913
Software:
ArcGIS for Desktop Advanced 10.1
ArcGIS for Desktop Standard 10.1
ArcGIS for Desktop Basic 10.1
Platforms:
Windows XP, Server 2003, Vista, Server 2008, Windows 7, Windows 8, Server 2012
【问题描述】
How can I check for null values in the Field Calculator using Python?
1 个回复
EsriSupport
赞同来自:
Starting at ArcGIS for Desktop 10.1, null values in an attribute table are returned as the string 'None' in the Field Calculator using Python. Knowing this, an if/elif statement can be used to find whether values are null or not. Here is an example script that checks if a field contains null values:
Expression:
findNulls(!fieldA!)
Expression Type:
PYTHON_9.3
Code Block:
def findNulls(fieldValue):
if fieldValue is None:
return "null values"
elif fieldValue is not None:
return "no nulls here"
【创建及修改时间】
Created: 3/7/2013
Last Modified: 11/18/2014
【原文链接】
http://support.esri.com/en/kno ... 40913
要回复问题请先登录或注册