Created
June 27, 2014 18:26
-
-
Save knu2xs/77ed7a8dc1333f8ffdc5 to your computer and use it in GitHub Desktop.
Clear fields to null with negative number placeholders in ArcGIS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # import modules | |
| import arcpy | |
| # feature class or table to modify | |
| table = r'path/to/featureClass/or/table' | |
| # create update cursor to interate data | |
| with arcpy.da.UpdateCursor(table, '*') as cursor: | |
| # iterate the rows | |
| for row in cursor: | |
| # value to store the row field index | |
| i = 0 | |
| # for every row field | |
| while i < len(row): | |
| # if the value in the field is less than zero | |
| if row[i] < 0: | |
| # set the value to None, or Null | |
| row[i] = None | |
| # increment the index | |
| i = i + 1 | |
| # update the row | |
| cursor.updateRow(row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment