1

Here I added a new field name "visArea" and want to put in the number from the "Count" column which "Value" equals one.That means the number of visible point(value=1)from selected observe spot.I used embedded Python 2.7 within ArcGIS 10.4 and my code are:

fc="PythonVisi2.tif"
Cursor=arcpy.da.UpdateCursor(fc,["Value","Count","visArea"])
for row in Cursor:
    if row[0] != 0:
    row[2]=row[1]
    cs3.updateRow(row[2])

But I got "TypeError: argument must be sequence of values".Which part goes wrong or how shold I fix the problem?enter image description here

2

You need "update" the complete row and use the name you have given the cursor so change cs3.updateRow(row[2]) to Cursor.updateRow(row).

Since you only have modified row[2] this is still the only value that will be updated.

  • Thank you.I tried and it works.But i don't get " the name you have given the cursor " since Count&VisArea is given as parameter in bracket.Do you mean i used for row in cursor rather than for row[2] in cursor? – Joe.Z Aug 9 '18 at 3:32
  • @Joe.Z you name the cursor Cursor with this line: Cursor=arcpy.da.UpdateCursor(fc,["Value","Count","visArea"]), so when you update it you need to use that name: Cursor.updateRow(row) – BERA Aug 9 '18 at 6:18
  • Indeed i neglected the name change.I actually want to ask since row[2] being the only value need updated, why does Cursor.updateRow(row) work while (row[2])doesn't ? – Joe.Z Aug 9 '18 at 7:47
  • That is just the way the updatecursor works. You always need the complete row in updateRow – BERA Aug 9 '18 at 7:49
  • I totally understand.Thank you for the patience. :) @BERA – Joe.Z Aug 9 '18 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.