Skip to content
Permalink
Browse files

Added "sum" field

Minor change just to add the "sum" to the output table result.
  • Loading branch information
nachouve committed Jun 15, 2015
1 parent f4c3f3d commit cf5b4543905affa260fa9b75b75993bd76190177
Showing with 4 additions and 4 deletions.
  1. +4 −4 python/plugins/processing/algs/qgis/StatisticsByCategories.py
@@ -81,11 +81,11 @@ def processAlgorithm(self, progress):
except:
pass

fields = ['category', 'min', 'max', 'mean', 'stddev', 'count']
fields = ['category', 'min', 'max', 'mean', 'stddev', 'sum', 'count']
writer = output.getTableWriter(fields)
for (cat, v) in values.items():
(min, max, mean, stddev) = calculateStats(v)
record = [cat, min, max, mean, stddev, len(v)]
(min, max, mean, stddev, sum) = calculateStats(v)
record = [cat, min, max, mean, stddev, sum, len(v)]
writer.addRecord(record)


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

0 comments on commit cf5b454

Please sign in to comment.
You can’t perform that action at this time.