We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 93f154c commit 599631cCopy full SHA for 599631c
pandas/core/groupby/generic.py
@@ -46,6 +46,7 @@
46
from pandas.core.index import Index, MultiIndex, CategoricalIndex
47
from pandas.core.arrays.categorical import Categorical
48
from pandas.core.internals import BlockManager, make_block
49
+from pandas.compat.numpy import _np_version_under1p13
50
51
from pandas.plotting._core import boxplot_frame_groupby
52
@@ -1206,7 +1207,8 @@ def count(self):
1206
1207
1208
mask = (ids != -1) & ~isna(val)
1209
ids = ensure_platform_int(ids)
- out = np.bincount(ids[mask], minlength=ngroups or None)
1210
+ minlength = ngroups or (None if _np_version_under1p13 else 0)
1211
+ out = np.bincount(ids[mask], minlength=minlength)
1212
1213
return Series(out,
1214
index=self.grouper.result_index,
0 commit comments