<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Copy attribute values from one table to another, in a loop in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332802#M25924</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Matthew,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;assetFeatureClass is a string not a row object.&amp;nbsp; That's why you're getting the error message when you try to do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;assetFeatureClass.Ditch_ID&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What you really mean is row.Ditch_ID but you're using the variable named 'row' twice.&amp;nbsp; That's where the confusion probably arises. You should avoid using the same variable name ('row') on the inside loop that you're trying to use from the outside loop--For example, you could change the inner loop to &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;for rowC in rows:&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That said, I don't think you really want a nested loop here. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe you could use the Python zip function to loop through both at once.&amp;nbsp; Here's an example of the zip function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;gt;&amp;gt;&amp;gt; listA = ['FID', 'Shape', 'COVER', 'RECNO'] &amp;gt;&amp;gt;&amp;gt; listB = ['OID', 'Geometry', 'String'] &amp;gt;&amp;gt;&amp;gt; for a, b in zip( listA, listB): ... print "a: ", a ,"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b: ", b ... a: FID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b: OID a: Shape&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b: Geometry a: COVER&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b: String&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So your code would be something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;assetRows = arcpy.UpdateCursor(assetFeatureClass,"[Processed] &amp;lt;&amp;gt; 'Y'","","","") centerRows = arcpy.UpdateCursor(centerline) for assetrow, rowCenter in zip(assetRows, centerRows): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; centerRow.Ditch_ID = assetRow.Ditch_ID &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #etc...&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Jun 2014 13:56:21 GMT</pubDate>
    <dc:creator>LT</dc:creator>
    <dc:date>2014-06-05T13:56:21Z</dc:date>
    <item>
      <title>Copy attribute values from one table to another, in a loop</title>
      <link>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332801#M25923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to copy the attribute values from one table to another, inside a loop.&amp;nbsp; I am looping through one table and inside that loop I want to copy the attribute values to another table.&amp;nbsp; I have copied attribute values over before, but using JoinField, but I do not want to use that in this code, as I am already looping through records.&amp;nbsp; I have seen different code attempting to do this, but so far nothing has worked for me.&amp;nbsp; The code I'm working with is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy import os import string import subprocess&amp;nbsp; arcpy.env.workspace = r"c:\Users\matt\Desktop\Ditch\Database\Centerline.mdb" assetFeatureClass = "[Assets]" assetrows = arcpy.UpdateCursor(assetFeatureClass,"[Processed] &amp;lt;&amp;gt; 'Y'","","","")&amp;nbsp; # for each row in the result set for row in assetrows: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print row.getValue("Ditch_ID")&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #create asset &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #Insert code to call out ArcObjects utility... &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; centerline = "[Pipeline_Centerline]" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #update asset record attributes from asset table &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.UpdateCursor(centerline) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Ditch_ID = assetFeatureClass.Ditch_ID&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get an error that states: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Runtime error&amp;nbsp; Traceback (most recent call last): &amp;nbsp; File "&amp;lt;string&amp;gt;", line 24, in &amp;lt;module&amp;gt; AttributeError: 'str' object has no attribute 'Ditch_ID'&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and I assume what is causing this is the row.Ditch_ID = assetFeatureClass.Ditch_ID section.&amp;nbsp; What I am trying to do in this section is to copy to the current record in the Centerline table the 'Ditch_ID' attribute value from the outer loop's record in the Assets table.&amp;nbsp; Also, I have to do this for several attributes (both tables have the same schema) and need to either iterate over the code for each, or somehow copy several attributes at once.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 13:23:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332801#M25923</guid>
      <dc:creator>MatthewWalker1</dc:creator>
      <dc:date>2014-06-05T13:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: Copy attribute values from one table to another, in a loop</title>
      <link>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332802#M25924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Matthew,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;assetFeatureClass is a string not a row object.&amp;nbsp; That's why you're getting the error message when you try to do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;assetFeatureClass.Ditch_ID&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What you really mean is row.Ditch_ID but you're using the variable named 'row' twice.&amp;nbsp; That's where the confusion probably arises. You should avoid using the same variable name ('row') on the inside loop that you're trying to use from the outside loop--For example, you could change the inner loop to &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;for rowC in rows:&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That said, I don't think you really want a nested loop here. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe you could use the Python zip function to loop through both at once.&amp;nbsp; Here's an example of the zip function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;gt;&amp;gt;&amp;gt; listA = ['FID', 'Shape', 'COVER', 'RECNO'] &amp;gt;&amp;gt;&amp;gt; listB = ['OID', 'Geometry', 'String'] &amp;gt;&amp;gt;&amp;gt; for a, b in zip( listA, listB): ... print "a: ", a ,"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b: ", b ... a: FID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b: OID a: Shape&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b: Geometry a: COVER&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b: String&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So your code would be something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;assetRows = arcpy.UpdateCursor(assetFeatureClass,"[Processed] &amp;lt;&amp;gt; 'Y'","","","") centerRows = arcpy.UpdateCursor(centerline) for assetrow, rowCenter in zip(assetRows, centerRows): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; centerRow.Ditch_ID = assetRow.Ditch_ID &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #etc...&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2014 13:56:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332802#M25924</guid>
      <dc:creator>LT</dc:creator>
      <dc:date>2014-06-05T13:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Copy attribute values from one table to another, in a loop</title>
      <link>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332803#M25925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Excellent, that worked!&amp;nbsp; Is there a way to loop through a set of attributes, or just list out each, such as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;centerrow.Ditch_ID = assetrow.Ditch_ID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; centerrow.Event_ID = assetrow.Event_ID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; centerrow.Comments = assetrow.Comments
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; centerrow.Diameter = assetrow.Diameter&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:45:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332803#M25925</guid>
      <dc:creator>MatthewWalker1</dc:creator>
      <dc:date>2021-12-11T15:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Copy attribute values from one table to another, in a loop</title>
      <link>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332804#M25926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you're using ArcGIS 10.1 or higher, you could use the newer style Data Access cursors.&amp;nbsp; Then you could loop through the tuple of attribute values. Here's an example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

fc = 'C:/data.shp'
fields = [ 'Event', 'Comments', 'Diameter' ]

cursor = arcpy.da.SearchCursor( fc , fields )
for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for attr in row:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print attr
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:45:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332804#M25926</guid>
      <dc:creator>LT</dc:creator>
      <dc:date>2021-12-11T15:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Copy attribute values from one table to another, in a loop</title>
      <link>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332805#M25927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not sure how to implement that into the code to iterate over the tuple of attributes.&amp;nbsp; What would I put in place of the 'print attr' line, to assign the current attribute in the tuple to the appropriate attribute in the centerline feature I am trying to update?&amp;nbsp; In other words, what takes the place of the explicit "centerrow.Ditch_ID = assetrow.Ditch_ID" attribute assignment?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor = arcpy.da.SearchCursor(centerline, fields)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for attr in row:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.cursor = assetrow.? #what should this line look like?
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #centerrow.Ditch_ID = assetrow.Ditch_ID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #centerrow.Event_ID = assetrow.Event_ID
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #centerrow.Comments = assetrow.Comments
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #centerrow.Diameter = assetrow.Diameter
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print centerrow.getValue("Ditch_ID")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #centerRows.updateRow(centerrow)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:45:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332805#M25927</guid>
      <dc:creator>MatthewWalker1</dc:creator>
      <dc:date>2021-12-11T15:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Copy attribute values from one table to another, in a loop</title>
      <link>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332806#M25928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Matthew,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think you need to use another zip, since you want to loop through both tuples of attributes at once. Something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
assetRows = arcpy.da.SearchCursor( fc1 , fields )
centerRows = arcpy.da.UpdateCursor( fc2 , fields )
for assetRow, centerRow in zip(assetRows, centerRows):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for assetAttr, centerAttr in zip(assetRow, centerRow):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; centerAttr = assetAttr
&amp;nbsp;&amp;nbsp;&amp;nbsp; centerRows.updateRow(centerRow)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:45:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332806#M25928</guid>
      <dc:creator>LT</dc:creator>
      <dc:date>2021-12-11T15:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Copy attribute values from one table to another, in a loop</title>
      <link>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332807#M25929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Rewrite your code to use a dictionary.&amp;nbsp; It will perform 10 times faster.&amp;nbsp; Something like this works:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;readFieldsList = ["OBJECTID", "RID", "MEAS", "X_COORD", "Y_COORD", "X_Y_LINK", "STNAME", "STNAMES", "X_Y_ROUTE"]
valueDict = {r[0]:(r[1:]) for r in arcpy.da.SearchCursor(readFC, readFieldsList)}

updateFieldsList =&amp;nbsp; ["FROM_OBJECTID","FROM_ROUTE_NAME","FROM_MEASURE","FROM_X_COORDINATE","FROM_Y_COORDINATE","FROM_X_Y_LINK","FROM_STREET_NAME","FROM_CROSS_STREETS","FROM_X_Y_ROUTE_NAME"]
with arcpy.da.UpdateCursor(updateFC, updateFieldsList) as updateRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for updateRow in updateRows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ObjectIDVal = updateRow[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ObjectIDVal in valueDict:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[1] = valueDict[ObjectIDVal][0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[2] = valueDict[ObjectIDVal][1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[3] = valueDict[ObjectIDVal][2]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[4] = valueDict[ObjectIDVal][3]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[5] = valueDict[ObjectIDVal][4]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[6] = valueDict[ObjectIDVal][5]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[7] = valueDict[ObjectIDVal][6]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[8] = valueDict[ObjectIDVal][7]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRow[9] = valueDict[ObjectIDVal][8]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateRows.updateRow(updateRow)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All you have to do is set your readFC and updateFC, change the field lists to match up your two feature classes and then include the correct number of transfer lines in the if condition of the loop.&amp;nbsp; Matches of about 100k records take about 20 to 30 seconds.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:45:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332807#M25929</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T15:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Copy attribute values from one table to another, in a loop</title>
      <link>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332808#M25930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Richard,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am relatively new to Python and search cursors. Can you explain what the value dictionary does?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;Judson&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Nov 2016 21:51:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332808#M25930</guid>
      <dc:creator>JudsonCrouch1</dc:creator>
      <dc:date>2016-11-22T21:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Copy attribute values from one table to another, in a loop</title>
      <link>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332809#M25931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First read my Blog post called &lt;A _jive_internal="true" href="https://community.esri.com/blogs/richard_fairhurst/2014/11/08/turbo-charging-data-manipulation-with-python-cursors-and-dictionaries"&gt;Turbo Charging Data Manipulation with Python Cursors and Dictionaries&lt;/A&gt;. &amp;nbsp;It covers this subject in much more depth with several examples of how to apply the technique and it provides code that is more standardized which&amp;nbsp;should be easier to customize to your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as a Python dictionary it works like a real world dictionary. &amp;nbsp;If you look up a word in a dictionary (a dictionary key) you will find all kinds of information related to that word (the value associated with the key). &amp;nbsp;Python dictionaries offer is an extremely fast way to directly lookup related information through meaningful key values, as opposed to lists which only support a lookup using&amp;nbsp;generally meaningless index number values or traversing the list in a loop. &amp;nbsp;Python dictionary keys are not limited to words and can be nearly anything that is an immutable value. &amp;nbsp;Tuples can be keys&amp;nbsp;and can be used to create composite value keys (i.e., multi-field keys like the separate components of an address). &amp;nbsp;Lists and Dictionaries are mutable and cannot be used as keys, but they can be values associated with a lookup key.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Nov 2016 22:57:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332809#M25931</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2016-11-22T22:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Copy attribute values from one table to another, in a loop</title>
      <link>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332810#M25932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the link to your blog post! That is exactly what I was looking for. I appreciate you taking the time to explain this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2016 13:15:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/copy-attribute-values-from-one-table-to-another-in/m-p/332810#M25932</guid>
      <dc:creator>JudsonCrouch1</dc:creator>
      <dc:date>2016-11-23T13:15:11Z</dc:date>
    </item>
  </channel>
</rss>

