HOW TO
Null values denote when a field has no value. Analyzing numeric data containing null values does not accurately represent the data. In cases where multiple fields contain null values in an attribute table, it is sometimes necessary to count the number of null values that exist in the fields. Counting the null values manually is impractical and tedious when working with a large dataset.
This article describes the workflow to count the number of null values in every field of an attribute table using ArcGIS API for Python.
import arcgis import pandas
in_fc = r"<Feature_Class_Folder_Path>" df = pandas.DataFrame.spatial.from_featureclass(in_fc)
idx = df.isnull() print(idx.sum())
The following shows the sample of a full script:
import arcgis import pandas infc = r"C:\Users\User\Desktop\Test_Folder\TestProject\Test.gdb\testing" sedf = pandas.DataFrame.spatial.from_featureclass(infc) idx = sedf.isnull() print(idx.sum())
The number of null values for each field in the attribute table is displayed in the Python window.
Article ID: 000028560
Get help from ArcGIS experts
Download the Esri Support App
You can also download the app to access the chatbot anytime! Download it now.