Every time I execute this, I get a runtime error pointing to my "for row in cursor," stating that A column was specified that does not exist. Any ideas how to fix this?
import arcpy
import os
gdb = r'C:\Users\Stephanie\Documents\SPRING20\PGIS\project1\usa_cities.gdb'
feature_class = "largest_cities"
fc = os.path.join(gdb, feature_class)
print(fc)
fields = ['NAME', 'POP2017']
with arcpy.da.SearchCursor(fc, fields) as cursor:
for row in cursor:
if row[2] != None:
print("City: " + str(row[2]) + " Population: " + str(row[9]))