<?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: using arcpy to extract values and calculate means from tables in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-arcpy-to-extract-values-and-calculate-means/m-p/1060724#M61202</link>
    <description>&lt;P&gt;Yes thats correct, effectively they are two levels of governance, so there are multiple LAD16CD values for each NUTS318CD value. I need to workout the average participation value for each NUTS3 code, as that is the level for my feature layer.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I think i need to extract unique values of the NUTS318CD field but i'm stuck on how i would go about calculating the average for each field if you understand my meaning&lt;/P&gt;</description>
    <pubDate>Sat, 22 May 2021 10:10:22 GMT</pubDate>
    <dc:creator>DanielFuller</dc:creator>
    <dc:date>2021-05-22T10:10:22Z</dc:date>
    <item>
      <title>using arcpy to extract values and calculate means from tables</title>
      <link>https://community.esri.com/t5/python-questions/using-arcpy-to-extract-values-and-calculate-means/m-p/1060375#M61187</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I have been given two tables, one has data that i need to link to the attribute table of a layer, but has no direct link to the layer.&lt;/P&gt;&lt;P&gt;The other table contains fields that link the layer attribute table and data table together.&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;data table (county links to link table fields)&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanielFuller_0-1621599757342.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13862iE3506D5D69BBFEB1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanielFuller_0-1621599757342.png" alt="DanielFuller_0-1621599757342.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Link table links LAD16CD to county of the data table and NUTS318CD of the feature layer&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanielFuller_1-1621600050937.png" style="width: 535px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13864iC657E59903A94DC3/image-dimensions/535x151?v=v2" width="535" height="151" role="button" title="DanielFuller_1-1621600050937.png" alt="DanielFuller_1-1621600050937.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Feature layer attribute table&amp;nbsp;&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DanielFuller_2-1621600150975.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13865i2EE0012F7104C625/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DanielFuller_2-1621600150975.png" alt="DanielFuller_2-1621600150975.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I need to link the tables together then extract the values for each county of interest and calculate the mean participation value from the data table and then link the mean to the feature layer.&lt;/P&gt;&lt;P&gt;in essence I need to have the attribute table of the feature layer have a field that contains the mean participation data for each NUTS3 code&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have no idea what approach to take and could do with some advice.&amp;nbsp;&lt;/P&gt;&lt;P&gt;current code that prunes the data looks like this&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.env.workspace = r"C:\Users\danie\Desktop\Python_assessment\data"

arcpy.TableToTable_conversion(os.path.join(data,'LAD_to_LAU1_to_NUTS3_to_NUTS2_to_NUTS1_January_2018_Lookup_in_the_UK'), Outdir, 'LAU.dbf')
arcpy.TableToTable_conversion(os.path.join(data,'SportsStatisticsForPython'), Outdir, 'Sports.dbf')

#declare paths to dbf paths as variables 
LAUtoNUT = Outdir + 'LAU.dbf'
Sports = Outdir + 'Sports.dbf'

fieldNameList = ['LAD16CD','LAD16NM','NUTS218CD', 'NUTS218NM','NUTS118CD','NUTS118NM'] #non required fields
arcpy.DeleteField_management(LAUtoNUT, fieldNameList) #removing fields from table
arcpy.JoinField_management(LAUtoNUT, "LAU118CD",Sports , "county", "") #joining the data and link tables 
arcpy.management.CopyRows(LAUtoNUT, Outdir + 'processed_data.dbf', )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 12:51:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-arcpy-to-extract-values-and-calculate-means/m-p/1060375#M61187</guid>
      <dc:creator>DanielFuller</dc:creator>
      <dc:date>2021-05-21T12:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: using arcpy to extract values and calculate means from tables</title>
      <link>https://community.esri.com/t5/python-questions/using-arcpy-to-extract-values-and-calculate-means/m-p/1060501#M61193</link>
      <description>&lt;P&gt;There appears to be a potential issue with the relationships between the fields you mentioned in the three tables. One NUTS318CD value can have many LAD16CD (county) values. Because of this, you'll be putting multiple different participation values together for each&amp;nbsp;NUTS3 code. Do you intend to sum or average the participation values? Alternatively, you would need to create multiple NUTS3 code features, each with a different participation value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 16:55:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-arcpy-to-extract-values-and-calculate-means/m-p/1060501#M61193</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-05-21T16:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: using arcpy to extract values and calculate means from tables</title>
      <link>https://community.esri.com/t5/python-questions/using-arcpy-to-extract-values-and-calculate-means/m-p/1060724#M61202</link>
      <description>&lt;P&gt;Yes thats correct, effectively they are two levels of governance, so there are multiple LAD16CD values for each NUTS318CD value. I need to workout the average participation value for each NUTS3 code, as that is the level for my feature layer.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I think i need to extract unique values of the NUTS318CD field but i'm stuck on how i would go about calculating the average for each field if you understand my meaning&lt;/P&gt;</description>
      <pubDate>Sat, 22 May 2021 10:10:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-arcpy-to-extract-values-and-calculate-means/m-p/1060724#M61202</guid>
      <dc:creator>DanielFuller</dc:creator>
      <dc:date>2021-05-22T10:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: using arcpy to extract values and calculate means from tables</title>
      <link>https://community.esri.com/t5/python-questions/using-arcpy-to-extract-values-and-calculate-means/m-p/1060976#M61220</link>
      <description>&lt;P&gt;Are you able to apply &lt;A href="https://community.esri.com/t5/python-questions/using-arcpy-tools-to-extract-means-from-one-table-and-join-them/m-p/1060775#M61209" target="_self"&gt;this solution you found&lt;/A&gt; to this discussion?&lt;/P&gt;</description>
      <pubDate>Mon, 24 May 2021 15:00:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-arcpy-to-extract-values-and-calculate-means/m-p/1060976#M61220</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-05-24T15:00:25Z</dc:date>
    </item>
  </channel>
</rss>

