fixed buggy mapIncremental behavior for anything else than averaging (the standard case luckily…)
This commit is contained in:
parent
4ed5553822
commit
ad06fc1a77
|
@ -479,13 +479,13 @@ def mapIncremental(label, mapping, N, base, new):
|
|||
# to a list of data
|
||||
# -----------------------------
|
||||
|
||||
theMap = { 'min': lambda n,b,a: min(b,a),
|
||||
'max': lambda n,b,a: max(b,a),
|
||||
theMap = { 'min': lambda n,b,a: a if n==0 else min(b,a),
|
||||
'max': lambda n,b,a: a if n==0 else max(b,a),
|
||||
'avg': lambda n,b,a: (n*b+a)/(n+1),
|
||||
'avgabs': lambda n,b,a: (n*b+abs(a))/(n+1),
|
||||
'sum': lambda n,b,a: b+a,
|
||||
'sumabs': lambda n,b,a: b+abs(a),
|
||||
'unique': lambda n,b,a: {True:a,False:'n/a'}[n==0 or b==a]
|
||||
'sum': lambda n,b,a: a if n==0 else b+a,
|
||||
'sumabs': lambda n,b,a: abs(a) if n==0 else b+abs(a),
|
||||
'unique': lambda n,b,a: a if n==0 or b==a else 'n/a'
|
||||
}
|
||||
if mapping in theMap:
|
||||
mapped = map(theMap[mapping],[N]*len(base),base,new) # map one of the standard functions to data
|
||||
|
|
Loading…
Reference in New Issue