Skip to content

Instantly share code, notes, and snippets.

@KHwong12
Last active May 14, 2019 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KHwong12/1356c08aa0b56b2fb814a0e9a2170976 to your computer and use it in GitHub Desktop.
Save KHwong12/1356c08aa0b56b2fb814a0e9a2170976 to your computer and use it in GitHub Desktop.
# The hexagon bin feature class and the related fields
table = 'hex_bins_MYS'
fields = ["Matsuya","Yoshinoya","Sukiya","Max_No","MainChain"]
with arcpy.da.UpdateCursor(table, fields) as cursor:
for row in cursor:
Mainchain = ""
for column_no in range(3):
if row[column_no] == row[3]:
Mainchain += fields[column_no][0]
else:
Mainchain += "-"
print(Mainchain)
row[-1] = Mainchain
cursor.updateRow(row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment