Private
Public Access
1
0

bug fix and additional filtering for spm<0

This commit is contained in:
Sander Roosendaal
2018-03-02 10:37:24 +01:00
parent c1158747e3
commit 66452b44c0
4 changed files with 52 additions and 15 deletions

View File

@@ -326,7 +326,10 @@ def wavg(group, avg_name, weight_name):
should return otherwise.
"""
d = group[avg_name]
w = group[weight_name]
try:
w = group[weight_name]
except KeyError:
return d.mean()
try:
return (d * w).sum() / w.sum()
except ZeroDivisionError: