I have to calculate the mean of a field considering only values greater than 0.
Here is the table
Id
count
1
12
2
9
3
6
4
5
0
7
8
10
11
13
14
15
16
17
Lots of ways to accomplish this, here is one:
from statistics import mean tbl = # path to table with arcpy.da.SearchCursor(tbl, "Count") as cur: avg = mean(row[0] for row in cur if row[0] > 0)
How to do this using code block in the field calculator?
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.