examples:
for field in arcpy.ListFields(fc):
if field.name != 'Hi':
arcpy.AddField_management(fc, 'Hi', 'FLOAT')
else:
print "kolona Hi vec postoji"
with arcpy.da.UpdateCursor(fc, (fieldNameList)) as cursor:
for row in cursor:
hi = sum(np.array([row[i]/(sum([row[i] for i in range(len(fieldNameList))])) for i in range(len(fieldNameList))])**2)
row[14] = hi # row[LAST] = hi ?????
cursor.updateRow(row)
del row
del cursor
That instead of row[14] use the last column of the defined list? examples:
row[last] = hi
Answer
Try the last element list selector used in Python:
row[-1] = hi
No comments:
Post a Comment