How to combine search and update cursor on one table to change values [closed] The 2019 Stack Overflow Developer Survey Results Are In Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar ManaraDebugging ArcPy script to search, get value, compare to field names and sum field values?Creating a value-counting table with search- and update cursorArcPy Update Cursor after nested Search Cursor giving tuple assignment error?Error when updating arcpy.SearchCursor to arcpy.da.SearchCursorArcpy Search Cursor Looping through columns to search for specific valuesUsing dictionary and cursors to calculate a field based on values from another table - KeyError [0]Using two Search and Update cursor pairs on the same feature classCalculating field with ArcPy cursor?Search Cursor Return Field Name If All Rows Contain a ValueSwitching from Nested Search Cursors to Dictionaries
Does Parliament hold absolute power in the UK?
Circular reasoning in L'Hopital's rule
Can we generate random numbers using irrational numbers like π and e?
What do I do when my TA workload is more than expected?
Why can't wing-mounted spoilers be used to steepen approaches?
Why doesn't a hydraulic lever violate conservation of energy?
60's-70's movie: home appliances revolting against the owners
Using dividends to reduce short term capital gains?
Was credit for the black hole image misappropriated?
Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?
For what reasons would an animal species NOT cross a *horizontal* land bridge?
Can each chord in a progression create its own key?
how can a perfect fourth interval be considered either consonant or dissonant?
should truth entail possible truth
What happens to a Warlock's expended Spell Slots when they gain a Level?
"is" operation returns false with ndarray.data attribute, even though two array objects have same id
Sub-subscripts in strings cause different spacings than subscripts
Keeping a retro style to sci-fi spaceships?
Loose spokes after only a few rides
Store Dynamic-accessible hidden metadata in a cell
Is there a way to generate uniformly distributed points on a sphere from a fixed amount of random real numbers per point?
ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?
Accepted by European university, rejected by all American ones I applied to? Possible reasons?
Presidential Pardon
How to combine search and update cursor on one table to change values [closed]
The 2019 Stack Overflow Developer Survey Results Are In
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraDebugging ArcPy script to search, get value, compare to field names and sum field values?Creating a value-counting table with search- and update cursorArcPy Update Cursor after nested Search Cursor giving tuple assignment error?Error when updating arcpy.SearchCursor to arcpy.da.SearchCursorArcpy Search Cursor Looping through columns to search for specific valuesUsing dictionary and cursors to calculate a field based on values from another table - KeyError [0]Using two Search and Update cursor pairs on the same feature classCalculating field with ArcPy cursor?Search Cursor Return Field Name If All Rows Contain a ValueSwitching from Nested Search Cursors to Dictionaries
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm working a script for drives, I would like to read the values from the "Layer" field, if the values state "D-DRIVE-PAVE-P" then I want the field "SURFACEM" to be ANG if not then GR.
import arcpy, os
cursor = arcpy.da.SearchCursor(MyTable, ["D-DRIVE-PAVE-P"])
for row in cursor:
D-DRIVE-PAVE-P.add(row[0]
cursor = arcpy.da.UpdateCursor(MyTable, ["Layer", "SURFACEM"])
for row in cursor:
if row[0] in D-DRIVE-PAVE-P:
row[1] = "ANG"
else:
row[1] = "GR"
cursor.updateRow(row)
del cursor
This is what I have however I am receiving a syntax error with this line of coding.
arcpy
New contributor
closed as unclear what you're asking by PolyGeo♦ Apr 7 at 7:18
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
I'm working a script for drives, I would like to read the values from the "Layer" field, if the values state "D-DRIVE-PAVE-P" then I want the field "SURFACEM" to be ANG if not then GR.
import arcpy, os
cursor = arcpy.da.SearchCursor(MyTable, ["D-DRIVE-PAVE-P"])
for row in cursor:
D-DRIVE-PAVE-P.add(row[0]
cursor = arcpy.da.UpdateCursor(MyTable, ["Layer", "SURFACEM"])
for row in cursor:
if row[0] in D-DRIVE-PAVE-P:
row[1] = "ANG"
else:
row[1] = "GR"
cursor.updateRow(row)
del cursor
This is what I have however I am receiving a syntax error with this line of coding.
arcpy
New contributor
closed as unclear what you're asking by PolyGeo♦ Apr 7 at 7:18
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
3
Add the error message to your question. You are missingas cursor:
at the searchcursor and the indentation after is incorrect. What is this supposed to do:D-DRIVE-PAVE-P.add(row[0]
– BERA
Apr 7 at 6:34
When you provide code, please make sure that it is the smallest code to exhibit the problem. You have dedicated ten-plus lines of the question to compiling a list which isn't used in the cursor blocks, and the cursor blocks themselves contain many syntax errors that prevent script execution (with
usage, indentation, variable naming, open parenthesis), which really ought to be resolved before the question is asked.
– Vince
Apr 7 at 12:58
2
your search cursor is misused. Update cursor is enough in your case, either with your test or by first making a layer (makefeaturelayer) that only include the row matching a quesry
– radouxju
Apr 8 at 16:40
add a comment |
I'm working a script for drives, I would like to read the values from the "Layer" field, if the values state "D-DRIVE-PAVE-P" then I want the field "SURFACEM" to be ANG if not then GR.
import arcpy, os
cursor = arcpy.da.SearchCursor(MyTable, ["D-DRIVE-PAVE-P"])
for row in cursor:
D-DRIVE-PAVE-P.add(row[0]
cursor = arcpy.da.UpdateCursor(MyTable, ["Layer", "SURFACEM"])
for row in cursor:
if row[0] in D-DRIVE-PAVE-P:
row[1] = "ANG"
else:
row[1] = "GR"
cursor.updateRow(row)
del cursor
This is what I have however I am receiving a syntax error with this line of coding.
arcpy
New contributor
I'm working a script for drives, I would like to read the values from the "Layer" field, if the values state "D-DRIVE-PAVE-P" then I want the field "SURFACEM" to be ANG if not then GR.
import arcpy, os
cursor = arcpy.da.SearchCursor(MyTable, ["D-DRIVE-PAVE-P"])
for row in cursor:
D-DRIVE-PAVE-P.add(row[0]
cursor = arcpy.da.UpdateCursor(MyTable, ["Layer", "SURFACEM"])
for row in cursor:
if row[0] in D-DRIVE-PAVE-P:
row[1] = "ANG"
else:
row[1] = "GR"
cursor.updateRow(row)
del cursor
This is what I have however I am receiving a syntax error with this line of coding.
arcpy
arcpy
New contributor
New contributor
edited Apr 8 at 16:54
T. Tobin
New contributor
asked Apr 7 at 5:19
T. TobinT. Tobin
11
11
New contributor
New contributor
closed as unclear what you're asking by PolyGeo♦ Apr 7 at 7:18
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as unclear what you're asking by PolyGeo♦ Apr 7 at 7:18
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
3
Add the error message to your question. You are missingas cursor:
at the searchcursor and the indentation after is incorrect. What is this supposed to do:D-DRIVE-PAVE-P.add(row[0]
– BERA
Apr 7 at 6:34
When you provide code, please make sure that it is the smallest code to exhibit the problem. You have dedicated ten-plus lines of the question to compiling a list which isn't used in the cursor blocks, and the cursor blocks themselves contain many syntax errors that prevent script execution (with
usage, indentation, variable naming, open parenthesis), which really ought to be resolved before the question is asked.
– Vince
Apr 7 at 12:58
2
your search cursor is misused. Update cursor is enough in your case, either with your test or by first making a layer (makefeaturelayer) that only include the row matching a quesry
– radouxju
Apr 8 at 16:40
add a comment |
3
Add the error message to your question. You are missingas cursor:
at the searchcursor and the indentation after is incorrect. What is this supposed to do:D-DRIVE-PAVE-P.add(row[0]
– BERA
Apr 7 at 6:34
When you provide code, please make sure that it is the smallest code to exhibit the problem. You have dedicated ten-plus lines of the question to compiling a list which isn't used in the cursor blocks, and the cursor blocks themselves contain many syntax errors that prevent script execution (with
usage, indentation, variable naming, open parenthesis), which really ought to be resolved before the question is asked.
– Vince
Apr 7 at 12:58
2
your search cursor is misused. Update cursor is enough in your case, either with your test or by first making a layer (makefeaturelayer) that only include the row matching a quesry
– radouxju
Apr 8 at 16:40
3
3
Add the error message to your question. You are missing
as cursor:
at the searchcursor and the indentation after is incorrect. What is this supposed to do: D-DRIVE-PAVE-P.add(row[0]
– BERA
Apr 7 at 6:34
Add the error message to your question. You are missing
as cursor:
at the searchcursor and the indentation after is incorrect. What is this supposed to do: D-DRIVE-PAVE-P.add(row[0]
– BERA
Apr 7 at 6:34
When you provide code, please make sure that it is the smallest code to exhibit the problem. You have dedicated ten-plus lines of the question to compiling a list which isn't used in the cursor blocks, and the cursor blocks themselves contain many syntax errors that prevent script execution (
with
usage, indentation, variable naming, open parenthesis), which really ought to be resolved before the question is asked.– Vince
Apr 7 at 12:58
When you provide code, please make sure that it is the smallest code to exhibit the problem. You have dedicated ten-plus lines of the question to compiling a list which isn't used in the cursor blocks, and the cursor blocks themselves contain many syntax errors that prevent script execution (
with
usage, indentation, variable naming, open parenthesis), which really ought to be resolved before the question is asked.– Vince
Apr 7 at 12:58
2
2
your search cursor is misused. Update cursor is enough in your case, either with your test or by first making a layer (makefeaturelayer) that only include the row matching a quesry
– radouxju
Apr 8 at 16:40
your search cursor is misused. Update cursor is enough in your case, either with your test or by first making a layer (makefeaturelayer) that only include the row matching a quesry
– radouxju
Apr 8 at 16:40
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
3
Add the error message to your question. You are missing
as cursor:
at the searchcursor and the indentation after is incorrect. What is this supposed to do:D-DRIVE-PAVE-P.add(row[0]
– BERA
Apr 7 at 6:34
When you provide code, please make sure that it is the smallest code to exhibit the problem. You have dedicated ten-plus lines of the question to compiling a list which isn't used in the cursor blocks, and the cursor blocks themselves contain many syntax errors that prevent script execution (
with
usage, indentation, variable naming, open parenthesis), which really ought to be resolved before the question is asked.– Vince
Apr 7 at 12:58
2
your search cursor is misused. Update cursor is enough in your case, either with your test or by first making a layer (makefeaturelayer) that only include the row matching a quesry
– radouxju
Apr 8 at 16:40