Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 4 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")

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

Your Answer


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.