Revision 7705
Added by Aaron Marcuse-Kubitza almost 12 years ago
lib/xml_func.py | ||
---|---|---|
341 | 341 |
return str(to - from_) |
342 | 342 |
funcs['_range'] = _range |
343 | 343 |
|
344 |
def _avg(items, node): |
|
345 |
count = 0 |
|
346 |
sum_ = 0. |
|
347 |
for name, value in conv_items(float, items): |
|
348 |
count += 1 |
|
349 |
sum_ += value |
|
350 |
if count == 0: return None # input is empty |
|
351 |
else: return str(sum_/count) |
|
352 |
funcs['_avg'] = _avg |
|
353 |
|
|
354 | 344 |
class CvException(Exception): |
355 | 345 |
def __init__(self): |
356 | 346 |
Exception.__init__(self, 'CV (coefficient of variation) values are only' |
Also available in: Unified diff
xml_func.py: Removed no longer used _avg(). Use SQL functions._avg() instead.