Skip to content

Commit e5cf34d

Browse files
committed
comment+GH ref
1 parent 5db0964 commit e5cf34d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/groupby/ops.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,9 @@ def _cython_operation(
697697
func(result, values, comp_ids, ngroups, is_datetimelike, **kwargs)
698698

699699
if kind == "aggregate":
700-
# i.e. counts is defined
700+
# i.e. counts is defined. Locations where count<min_count
701+
# need to have the result set to np.nan, which may require casting,
702+
# see GH#40767
701703
if is_integer_dtype(result.dtype) and not is_datetimelike:
702704
cutoff = max(1, min_count)
703705
empty_groups = counts < cutoff

0 commit comments

Comments
 (0)