My goal is to count the number of wells in each county. I've verified the columns are correct as listed in the attribute table. Do I have a typing or formatting error? I wanted to pull county names from a list but I'm trying to T/S with one variable first.
import arcpy arcpy.overWriteOutput = True arcpy.env.workspace = "E:\\GIS4080\\Week5\\Lesson5_Data" # Variables wells = "Wells.shp" counties = "COUNTIES.shp" Wells_Intersect = "Wells_Intersect.shp" Wells_Intersect_Layer = "Wells_Intersect_Layer" input_f = ["Wells.shp", "COUNTIES.shp"] Date_list =  wellCnt = 0 # Process: Intersect arcpy.Intersect_analysis(input_f, Wells_Intersect, "ALL", "", "INPUT") # Process: Make Feature Layer arcpy.MakeFeatureLayer_management(Wells_Intersect, Wells_Intersect_Layer) # List County Names countyList = [row for row in arcpy.da.SearchCursor(counties, "COUNTY")] #print countyList # Count Wells in each County #for cname in countyList: cname = "YUMA" with arcpy.da.SearchCursor(Wells_Intersect_Layer, "COUNTY", '"COUNTY "= ' + cname) as cursor: for row in cursor: wellCnt = wellCnt + 1 print cname, str(wellCnt)
Traceback (most recent call last):
File "E:\GIS4080\Week5\L5_hw.py", line 32, in
for row in cursor:
RuntimeError: A column was specified that does not exist.