Skip to content

Commit cf5b454

Browse files
committed
Added "sum" field
Minor change just to add the "sum" to the output table result.
1 parent f4c3f3d commit cf5b454

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python/plugins/processing/algs/qgis/StatisticsByCategories.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ def processAlgorithm(self, progress):
8181
except:
8282
pass
8383

84-
fields = ['category', 'min', 'max', 'mean', 'stddev', 'count']
84+
fields = ['category', 'min', 'max', 'mean', 'stddev', 'sum', 'count']
8585
writer = output.getTableWriter(fields)
8686
for (cat, v) in values.items():
87-
(min, max, mean, stddev) = calculateStats(v)
88-
record = [cat, min, max, mean, stddev, len(v)]
87+
(min, max, mean, stddev, sum) = calculateStats(v)
88+
record = [cat, min, max, mean, stddev, sum, len(v)]
8989
writer.addRecord(record)
9090

9191

@@ -115,4 +115,4 @@ def calculateStats(values):
115115
else:
116116
variance = 0
117117
stddev = math.sqrt(variance)
118-
return (minvalue, maxvalue, mean, stddev)
118+
return (minvalue, maxvalue, mean, stddev, sum)

0 commit comments

Comments
 (0)