Hello,
Fairly new to python. By no means a beginner, but I still have trouble with logic.
I'm currently trying to create a script which takes an ID field - if the IDs match up, then take the value from a name field, and concatenate together into a list, and fill out a concatenated list field (see table)
I know i will have to use a update_cursor and a counter etc. the logic for whatever reason is escaping me on how to assemble the python.
ID | Name | Name_cancat |
33 | hello | Hello, hi, bye |
33 | hi | Hello, hi, bye |
33 | bye | Hello, hi, bye |
44 | red | Red, tan, blue |
44 | tan | Red, tan, blue |
44 | blue | Red, tan, blue |
88 | dog | Dog, cat |
88 | cat | Dog, cat |
I know it will be something like this (obviously missing a ton of code/logic)
with arcpy.da.UpdateCursor("FC", ['ID', 'name', 'name_concat']) as cursor:
myList = []
for row in cursor:
myList.append(row[1])
row[2] = myList
cursor.updateRow(row)
any help pointing me to a resource would be greatly appreciated!