3

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")

1 Answer 1

4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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