Dear friends,
I have the following case:
I have a feature class (within a feature dataset, within a file gdb) with several fields. Two fields are of interest: "Date"(date) and "Type"(string). I want to run statistics on the "Type" field based on "Date" field. Date field has repetitive values, so the table would look like this:
Type Date
Type1 Date1
Type1 Date2
Type2 Date1
Type2 Date2
Type2 Date1....and so on
So, at the and I have many "Types" distributed in 3-4 different dates. I am trying to calculate how many different "types" occur at each date. For example the output should show:
Date1: 1 Type1 and 2 Type2
Date2: 1 Type1 and 1 Type2.
For this task I thought I would use the Frequency tool like this:
But I get an error: "invalid field type".
Using the arcpy.Statistics_analysis, I get a count of how many features I have for each date but not of what "Type" they are.
Anybody has an idea how could I solve this?
Thank you
I have the following case:
I have a feature class (within a feature dataset, within a file gdb) with several fields. Two fields are of interest: "Date"(date) and "Type"(string). I want to run statistics on the "Type" field based on "Date" field. Date field has repetitive values, so the table would look like this:
Type Date
Type1 Date1
Type1 Date2
Type2 Date1
Type2 Date2
Type2 Date1....and so on
So, at the and I have many "Types" distributed in 3-4 different dates. I am trying to calculate how many different "types" occur at each date. For example the output should show:
Date1: 1 Type1 and 2 Type2
Date2: 1 Type1 and 1 Type2.
For this task I thought I would use the Frequency tool like this:
Code:
import arcpy, os, sys
from arcpy import env
d = r"D:\Work\Python\Report\report.gdb"
env.workspace = d
datasetList = arcpy.ListDatasets("", "Feature")
frequencyFields = ["Type"]
summaryFields = ["Date"]
for dataset in datasetList:
env.workspace = d + "\\" + str(dataset)
featureList = arcpy.ListFeatureClasses()
for fc in featureList:
arcpy.Frequency_analysis(fc, "table_"+fc+".dbf",frequencyFields, summaryFields)Using the arcpy.Statistics_analysis, I get a count of how many features I have for each date but not of what "Type" they are.
Anybody has an idea how could I solve this?
Thank you