Error 000800 in Summary Statistics in script tool

1765
4
Jump to solution
04-11-2018 09:21 AM
VishalShah2
Occasional Contributor II

Edit at the bottom.

So I am creating a script tool to be able to provide reports on a weekly basis without having to enter in the parameters over and over again where as I can just click a button to run it for me in the form of a script tool.

Here's what my script looks like:

import arcpy
import os
import arcpy.mapping as map
from arcpy import env
import datetime

mxd = arcpy.mapping.MapDocument("Current")
slackFeatures = r'Slack Features'
date = datetime.date.today()
reportsGDB = r'\\Desktop\Summary_Report\Slack_Summary_Reports.gdb'
reportsFolder = r'\\Desktop\Summary_Reports'

inLayer = slackFeatures
outputName = 'slack_summary'
outLayer = reportsGDB + "/" + outputName
statsFields = ["footage", "SUM"]
caseFields = ["NetworkID", "ProjectID", "type"]

arcpy.Statistics_analysis(inLayer, outLayer, statsFields, caseFields)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This gives me the Error 000800: The value is not a member of SUM | MEAN | MIN | MAX | RANGE | STD | COUNT | FIRST | LAST.

Inputting these parameters manually into the Summary Statistics tool works but it doesn't in the script. I am currently out of ideas to solve this and am open to ideas to try out.

The field footage is a Long field and works manually in the Summary Statistics tool but does not work in the script. I tried the summary statistics tool on another feature class and the custom fields we have in that are Double which the summary statistics works fine for in the script. I tried it on a Long field again for the feature class with the custom fields and the summary statistics throws back the same error.

Why the Summary Statistics tool not work in a script for Long fields but would work for Double fields?

0 Kudos
1 Solution

Accepted Solutions
BalajiVeera
Occasional Contributor

statistics_fields parameter should be within the list

import arcpy
import os
import arcpy.mapping as map
from arcpy import env
import datetime

mxd = arcpy.mapping.MapDocument("Current")
slackFeatures = r'Slack Features'
date = datetime.date.today()
reportsGDB = r'\\Desktop\Summary_Report\Slack_Summary_Reports.gdb'
reportsFolder = r'\\Desktop\Summary_Reports'

inLayer = slackFeatures
outputName = 'slack_summary'
outLayer = reportsGDB + "/" + outputName
statsFields =  [["footage", "SUM"]]
caseFields = ["NetworkID", "ProjectID", "type"]

arcpy.Statistics_analysis(inLayer, outLayer, statsFields, caseFields)

View solution in original post

4 Replies
SteveLynch
Esri Regular Contributor

run the the geoprocessing tool and then from the results tab copy the Python code and have a look to see what you're missing.

0 Kudos
VishalShah2
Occasional Contributor II

Steve,

Here is the output of that. I'm not seeing anything different other than the location. Location of the output shouldn't matter. And my stats field and case field are the same.

arcpy.Statistics_analysis(in_table="Slack Features", out_table="C:/Users/vshah/Documents/ArcGIS/Default.gdb/DBO_Statistics5", statistics_fields="footage SUM", case_field="NetworkID;ProjectID;type")‍‍
0 Kudos
BalajiVeera
Occasional Contributor

statistics_fields parameter should be within the list

import arcpy
import os
import arcpy.mapping as map
from arcpy import env
import datetime

mxd = arcpy.mapping.MapDocument("Current")
slackFeatures = r'Slack Features'
date = datetime.date.today()
reportsGDB = r'\\Desktop\Summary_Report\Slack_Summary_Reports.gdb'
reportsFolder = r'\\Desktop\Summary_Reports'

inLayer = slackFeatures
outputName = 'slack_summary'
outLayer = reportsGDB + "/" + outputName
statsFields =  [["footage", "SUM"]]
caseFields = ["NetworkID", "ProjectID", "type"]

arcpy.Statistics_analysis(inLayer, outLayer, statsFields, caseFields)
VishalShah2
Occasional Contributor II

That did the trick! Thank you so much Balaji!

0 Kudos