I have want to create geodatabase table from geodatabase feature class. i have the following codes
Occurances = 
with arcpy.da.SearchCursor (fc, field) as cursor:
for row in cursor:
for i in set(Occurances):
icount = Occurances.count(i)
print (str(i) + ":", icount)
but instead of printing i really want to create a table using python that shows item name and the number of times in appears in the the feature class. any help would be very much appreciated. thanks
Either the Summary Statistics or Frequency tool would be easier and faster than doing this with a search cursor. Have you tried that?
hello, yeah i tried that! i don't want to use any existing geoprocessing tools. i was wondering to how to do in python code without it.
If you want to work with table data in Python, I recommend the arcpy method to copy tables to numpy arrays and using pandas. Right @DanPatterson_Retired ?
TableToNumPyArray to get the array
python, numpy, scipy, etc, magic analysis here....
NumPyArrayToTable to get the results back into Pro
I think something like this would create and populate the table.
tbl = <path to table> arcpy.management.CreateTable(os.path.dirname(tbl), os.path.basename(tbl)) arcpy.management.AddField(tbl, 'name', 'TEXT', field_length=255) arcpy.management.AddField(tbl, 'count', 'LONG') with arcpy.da.InsertCursor(tbl, ['name', 'count']) as cursor: for i in set(Occurances): cursor.insertRow([str(i), Occurances.count(i)])