<?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: Problem with coding on ExportXYv_stats  tool in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-with-coding-on-exportxyv-stats-nbsp-tool/m-p/617864#M48191</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have had a lot of problems with that tool as well, it seems to always have strange behavior.&amp;nbsp; I have just been using a work around and creating text files manually.&amp;nbsp; Here is an example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 print 'Creating Text File...'
&amp;nbsp;&amp;nbsp;&amp;nbsp; text = open(p.join(ws, "Addresses2.txt"), "w")
&amp;nbsp;&amp;nbsp;&amp;nbsp; text.writelines('"Parcel_ID"\t"FULL_ADD"\t"POINT_X"\t"POINT_Y"')
&amp;nbsp;&amp;nbsp;&amp;nbsp; srows = arcpy.SearchCursor(address)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in srows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pid = row.getValue('PID')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add = row.getValue('FULL_ADD')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp; = row.getValue('POINT_X')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y&amp;nbsp;&amp;nbsp; = row.getValue('POINT_Y')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text.writelines('\n"%s"\t"%s"\t%f\t%f' % (pid,add,x,y))
&amp;nbsp;&amp;nbsp;&amp;nbsp; text.close()
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; del row, srows
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Text File Created Successfully'
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This script uses a search cursor to grab the values from a table and writes them out into a text file.&amp;nbsp; This one is tab delimited, but it can easily be changed to comma delimited by replacing the \t with a comma.&amp;nbsp; If you don't have a lot of fields to write out this could be used as a work around.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 02:23:57 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-12-12T02:23:57Z</dc:date>
    <item>
      <title>Problem with coding on ExportXYv_stats  tool</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-coding-on-exportxyv-stats-nbsp-tool/m-p/617862#M48189</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;BR /&gt;&lt;SPAN&gt;I'm having issues with the arcpy tool arcpy.ExportXYv_stats. According to the documentation, the tool accepts 5 arguments, but I can't get the tool to accept the final argument, which determines whether variable labels will be included in an exported ASCII file. (I'm running Arc 10).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any advice?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Sep 2012 23:38:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-coding-on-exportxyv-stats-nbsp-tool/m-p/617862#M48189</guid>
      <dc:creator>NickEubank</dc:creator>
      <dc:date>2012-09-03T23:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with coding on ExportXYv_stats  tool</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-coding-on-exportxyv-stats-nbsp-tool/m-p/617863#M48190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you post the full code? I have included this function in many scripts for creating spreadsheets for the non-GIS people in my office. Here is what it looks like in one of my scripts:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy, os, sys, traceback

arcpy.env.workspace = 'G:\\Data\\Geodatabase\\Cedar_County.mdb'
arcpy.env.overwriteOutput = True

infeat = 'G:\\Data\\Geodatabase\\Cedar_County.mdb\\SOILS\\SOILS_BY_PARCEL'
outputpath = 'O:\\CSR_Report\\'
dissolveoutpath = 'G:\\PROJECTS\\Cedar\\Soils\\testing\\'
outfeat = dissolveoutpath + 'dissolve.shp'
out_table = outputpath + 'CSR_Report.csv'

dfield = "PID"
statfield = "WEIGHTED_AVERAGE_CSR FIRST; SUM_ FIRST"
dfield = ['PID']

expression = "!FIRST_WEIG!"
expression2 = "!FIRST_SUM_!"
dropfields = ["FIRST_WEIG", "FIRST_SUM_"]

try:


&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Starting Dissolve..."
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Dissolve_management(infeat, outfeat, dfield, statfield,
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "MULTI_PART", "DISSOLVE_LINES")

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(outfeat, "AVE_CSR", "FLOAT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(outfeat, "AVE_CSR", expression,
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "PYTHON")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(outfeat, "TOTAL_CSR", "FLOAT")
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(outfeat, "TOTAL_CSR", expression2,
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "PYTHON")
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Cleaning table' 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteField_management(outfeat, dropfields)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Dissolve finished, now converting table to CSV'

&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldnames = [f.name for f in arcpy.ListFields(outfeat)]
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ExportXYv_stats(outfeat, fieldnames, "COMMA", out_table,
&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;&amp;nbsp;&amp;nbsp; "ADD_FIELD_NAMES")
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'CSR table created sucessfully'

except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError(arcpy.GetMessages(2))
&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:42:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-coding-on-exportxyv-stats-nbsp-tool/m-p/617863#M48190</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T16:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with coding on ExportXYv_stats  tool</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-coding-on-exportxyv-stats-nbsp-tool/m-p/617864#M48191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have had a lot of problems with that tool as well, it seems to always have strange behavior.&amp;nbsp; I have just been using a work around and creating text files manually.&amp;nbsp; Here is an example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 print 'Creating Text File...'
&amp;nbsp;&amp;nbsp;&amp;nbsp; text = open(p.join(ws, "Addresses2.txt"), "w")
&amp;nbsp;&amp;nbsp;&amp;nbsp; text.writelines('"Parcel_ID"\t"FULL_ADD"\t"POINT_X"\t"POINT_Y"')
&amp;nbsp;&amp;nbsp;&amp;nbsp; srows = arcpy.SearchCursor(address)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in srows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pid = row.getValue('PID')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add = row.getValue('FULL_ADD')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp; = row.getValue('POINT_X')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y&amp;nbsp;&amp;nbsp; = row.getValue('POINT_Y')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text.writelines('\n"%s"\t"%s"\t%f\t%f' % (pid,add,x,y))
&amp;nbsp;&amp;nbsp;&amp;nbsp; text.close()
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; del row, srows
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Text File Created Successfully'
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This script uses a search cursor to grab the values from a table and writes them out into a text file.&amp;nbsp; This one is tab delimited, but it can easily be changed to comma delimited by replacing the \t with a comma.&amp;nbsp; If you don't have a lot of fields to write out this could be used as a work around.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:23:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-coding-on-exportxyv-stats-nbsp-tool/m-p/617864#M48191</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T02:23:57Z</dc:date>
    </item>
  </channel>
</rss>

