<?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: Getting attribute table using Python in arcgis 10 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755395#M58266</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you trying to Sum the two lists together based on the index of each list?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;listA = [1,2,3,4,3,2,1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;listB = [7,8,9,5,4,3,1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;index[0] = 7 + 1 = 8&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;index[1] = 8 + 2 = 10&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;index[2] = 9 + 3 = 12&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are, you can use the following code to do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os

listA = [1,2,3,4,3,2,1]

listB = [7,8,9,5,4,3,1]

listC = []

x = 0

while x &amp;lt; len(listA):
&amp;nbsp;&amp;nbsp;&amp;nbsp; listC.append(listB&lt;X&gt; + listA&lt;X&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp; x += 1
&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; 
print listC&lt;/X&gt;&lt;/X&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 08:02:48 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2021-12-12T08:02:48Z</dc:date>
    <item>
      <title>Getting attribute table using Python in arcgis 10</title>
      <link>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755389#M58260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; I am new to python scripting. Can anyone pls help me on the below query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1.I have one MXD, which contains 10 shapefiles.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- i am able to access these shapefiles using arcpy.mapping.listfeatures(mxd).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2.Based on the shapefile names, i have to access the different colmns in the attribute table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---- Here i am unable to access the layer attribute table. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ----- by using arcpy.listfields(shapefile), i am trying&amp;nbsp; to get the column values. But i am getting some object references.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jul 2011 03:01:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755389#M58260</guid>
      <dc:creator>SreenivasaRaoPigili</dc:creator>
      <dc:date>2011-07-06T03:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Getting attribute table using Python in arcgis 10</title>
      <link>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755390#M58261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not sure if the behavior is the same in 10 but in 9.3 the fields returned by the listFields method are field objects.&amp;nbsp; You can access their name and type using the .Name and .Type members.&amp;nbsp; Here is a short example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;fields = gp.listFields(shapefile, "*", "ALL")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for field in fields:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; print field.Name, ' : ', field.Type&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jul 2011 13:08:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755390#M58261</guid>
      <dc:creator>JosephArmbruster</dc:creator>
      <dc:date>2011-07-06T13:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Getting attribute table using Python in arcgis 10</title>
      <link>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755391#M58262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you want to access the actual cell values in the columns, use a cursor (like a &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00p60000000p000000.htm"&gt;SearchCursor&lt;/A&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jul 2011 13:39:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755391#M58262</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2011-07-06T13:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: Getting attribute table using Python in arcgis 10</title>
      <link>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755392#M58263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Thanks for giving reply. Now the issue got resolved.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Currently I am facing one more issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Actually I have two lists. let us say, listA = [1,2,3,4,3,2,1] and listB = [7,8,9,5,4,3,1]. Here have to get output like below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in listA, we are getting value-1 in 2 indexes. I have to sum the values from listB in those positions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally I have to output like below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sum of 1's is ----7+1=8&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sum of 2's is ---8+3=11&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sum of 3's is----9+4=13&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sum of 4's is----5&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;can you please help on this task.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2011 12:25:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755392#M58263</guid>
      <dc:creator>SreenivasaRaoPigili</dc:creator>
      <dc:date>2011-07-20T12:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: Getting attribute table using Python in arcgis 10</title>
      <link>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755393#M58264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can accomplish this by using a dictionary. Here's some code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;dict={}
for x in zip(listA,listB):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if x[0] in dict:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dict[x[0]] += x[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dict[x[0]] = x[1]
newListA=dict.keys()
newListB=dict.values()
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:02:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755393#M58264</guid>
      <dc:creator>BruceNielsen</dc:creator>
      <dc:date>2021-12-12T08:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: Getting attribute table using Python in arcgis 10</title>
      <link>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755394#M58265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There are many ways to do this (&lt;/SPAN&gt;&lt;A href="http://docs.python.org/release/2.6/tutorial/datastructures.html"&gt;check here for an intro to lists&lt;/A&gt;&lt;SPAN&gt;), but I would start by making a loop to go through the list, a counter to keep track of the index position, and using the list.reverse method to flip the list. Add the current index value to the flipped index value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: Correct me if I'm wrong, but in your example you're adding the first to last value, second to second-last, and so on...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2011 14:07:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755394#M58265</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2011-07-20T14:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Getting attribute table using Python in arcgis 10</title>
      <link>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755395#M58266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you trying to Sum the two lists together based on the index of each list?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;listA = [1,2,3,4,3,2,1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;listB = [7,8,9,5,4,3,1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;index[0] = 7 + 1 = 8&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;index[1] = 8 + 2 = 10&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;index[2] = 9 + 3 = 12&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are, you can use the following code to do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import os

listA = [1,2,3,4,3,2,1]

listB = [7,8,9,5,4,3,1]

listC = []

x = 0

while x &amp;lt; len(listA):
&amp;nbsp;&amp;nbsp;&amp;nbsp; listC.append(listB&lt;X&gt; + listA&lt;X&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp; x += 1
&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; 
print listC&lt;/X&gt;&lt;/X&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:02:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755395#M58266</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-12T08:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Getting attribute table using Python in arcgis 10</title>
      <link>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755396#M58267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thanks for yours quick response.&amp;nbsp; Thanks Bruce Nielsen. yours approach is solving my problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2011 15:33:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getting-attribute-table-using-python-in-arcgis-10/m-p/755396#M58267</guid>
      <dc:creator>SreenivasaRaoPigili</dc:creator>
      <dc:date>2011-07-21T15:33:28Z</dc:date>
    </item>
  </channel>
</rss>

