When getting to know a feature class, or analyzing one I'm familiar with, the Frequency tool is helpful. But if I'm not mistaken, Frequency is not available at all levels of ArcGIS Desktop. Also, the Frequency tool always outputs a persisted table, and I don't always want that. Here is how to generate a Pandas object consisting of unique combinations of values in multiple fields, along with counts of how frequently those combinations appear. This code is mostly useful for text/string fields. Other pandas properties are good for numeric fields, which is outside the scope of this post.
import arcgis, pandas
df = pandas.DataFrame.spatial.from_featureclass("Sidewalk Repair Inventory")
dfFiltered = df[df["STATUS"] == "CLOSED"]
dfStats = dfFiltered.groupby(by=["Field1", "Field2"])
result = dfFrequency.size()
print(result)
Sorry the formatting of this post is odd. I couldn't fix it. I don't know how, in this forum, to post an ordered list of steps while continuing the order below the code segments.
I am not sure which product you are using, ArcGIS Desktop (ArcMap) or ArcGIS Pro, as you mentioned both. If you are using ArcGIS Pro, I would like to mention two things for you:
1. Frequency is available at Basic licensing level.
2. Summary Statistics has an option:
https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/summary-statistics.htm
Hope you can use ArcGIS Pro for your processing.
I wanted to add that charts are another effective way of exploring your data in ArcGIS Pro. Bar charts can help you quickly visualize the frequency distributions for categorical fields without needing to create an extra output table.
Here I’ve created a bar chart that shows the counts for AirBNB listings by the “neighbourhood_group” field:
You can even group the data by an additional categorical field by selecting the field in the Split by dropdown. Here I’ve split the chart above by the “room_type” field, and now it displays the breakdown of AirBNB listings by “neighbourhood_group” and “room_type”:
For more information on creating and configuring charts in ArcGIS Pro, please see the following documentation page:
https://pro.arcgis.com/en/pro-app/latest/help/analysis/geoprocessing/charts/charts-quick-tour.htm