Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

How can I add multiple stats from the arcpy.Statistics_analysis to a single output file. Can I create a text file instead of a table ?

Using one of the examples in help.arcgis, if I add other stat analysis, what is the best way to work with the output?

import arcpy
from arcpy import env
env.workspace = "C:/data/Habitat_Analysis.gdb"
arcpy.Statistics_analysis("futrds", "C:/output/output.gdb/stats1", [["Shape_Length", "SUM"]], "NM")
arcpy.Statistics_analysis("futrds", "C:/output/output.gdb/stats2", [["Shape_Length", "MEAN"]], "NM")
arcpy.Statistics_analysis("futrds", "C:/output/output.gdb/stats3", [["Shape_Length", "STD"]], "NM")
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

From the look of page you linked to, you can get several summary statistics in one go. Have you tried:

arcpy.Statistics_analysis("futrds", "C:/output/output.gdb/stats1", [["Shape_Length", "SUM"],["Shape_Length", "MEAN"],["Shape_Length", "STD"]], "NM")

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00080000001z000000

As far as creating a text file, it doesn't look like it but you could always open the table later and then write it out to a text file. Python makes it pretty easy to work with cursors and text files.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.