Skip to content

Commit

Permalink
Remove depr. warning in SeriesGroupBy.count (pandas-dev#22155)
Browse files Browse the repository at this point in the history
  • Loading branch information
topper-123 authored and dberenbaum committed Aug 3, 2018
1 parent c872e40 commit d2aaf00
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from pandas.core.index import Index, MultiIndex, CategoricalIndex
from pandas.core.arrays.categorical import Categorical
from pandas.core.internals import BlockManager, make_block
from pandas.compat.numpy import _np_version_under1p13

from pandas.plotting._core import boxplot_frame_groupby

Expand Down Expand Up @@ -1206,7 +1207,8 @@ def count(self):

mask = (ids != -1) & ~isna(val)
ids = ensure_platform_int(ids)
out = np.bincount(ids[mask], minlength=ngroups or None)
minlength = ngroups or (None if _np_version_under1p13 else 0)
out = np.bincount(ids[mask], minlength=minlength)

return Series(out,
index=self.grouper.result_index,
Expand Down

0 comments on commit d2aaf00

Please sign in to comment.