Skip to content

Commit d2aaf00

Browse files
topper-123dberenbaum
authored andcommitted
Remove depr. warning in SeriesGroupBy.count (pandas-dev#22155)
1 parent c872e40 commit d2aaf00

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/groupby/generic.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
from pandas.core.index import Index, MultiIndex, CategoricalIndex
4747
from pandas.core.arrays.categorical import Categorical
4848
from pandas.core.internals import BlockManager, make_block
49+
from pandas.compat.numpy import _np_version_under1p13
4950

5051
from pandas.plotting._core import boxplot_frame_groupby
5152

@@ -1206,7 +1207,8 @@ def count(self):
12061207

12071208
mask = (ids != -1) & ~isna(val)
12081209
ids = ensure_platform_int(ids)
1209-
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)
12101212

12111213
return Series(out,
12121214
index=self.grouper.result_index,

0 commit comments

Comments
 (0)