Skip to content

Commit 47745f4

Browse files
committed
fix: convert booleans to ints before summing them up
1 parent 1463bfc commit 47745f4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/_gettsim/aggregation_numpy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def grouped_count(group_id):
1717
def grouped_sum(column, group_id):
1818
fail_if_dtype_not_int(group_id, agg_func="grouped_sum")
1919
fail_if_dtype_not_numeric_or_boolean(column, agg_func="grouped_sum")
20-
20+
if column.dtype == bool:
21+
column = column.astype(int)
2122
out_on_hh = npg.aggregate(group_id, column, func="sum", fill_value=0)
2223

2324
# Expand to individual level

0 commit comments

Comments
 (0)