I want to create ArcGIS geodatabase domains from a CSV file.The problem is that my output says field values in the row are "None". It doesn't recognize the values in my CSV file.
Any ideas ?
Here's the code I am using :
import arcpy
import csv
arcpy.env.workspace = "D:/DATA"
gdb = "NEW.sde"
csvfile = "D:/DATA/Domains.csv"
domains = []
rows = []
with open(csvfile, 'r') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
try:
domains.append(row.get('domain'))
rows.append(row)
except KeyError:
rows = [row]
domains = list(set(domains))
print("Identified %s unique domains" % len(domains))
print("Identified %s codes" % len(rows))
print("Creating codes:")
for row in rows:
print("%s\t%s\t%s" % (row.get('domain'), row.get('code'), row.get('code_description')))
arcpy.AddCodedValueToDomain_management(gdb, row['domain'], row['code'], row['code_description'])
print("Done")
And here's my CSV File:
[![enter code here][1]][1]