Skip to content

Commit 32a5fcf

Browse files
tptopper-123
tp
authored andcommitted
changes according to comments
1 parent 2fe943a commit 32a5fcf

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

doc/source/whatsnew/v0.23.4.txt

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ Bug Fixes
3232

3333
- Bug where calling :func:`DataFrameGroupBy.agg` with a list of functions including ``ohlc`` as the non-initial element would raise a ``ValueError`` (:issue:`21716`)
3434
- Bug in ``roll_quantile`` caused a memory leak when calling ``.rolling(...).quantile(q)`` with ``q`` in (0,1) (:issue:`21965`)
35-
- Bug in :func:`pandas.core.groupby.SeriesGroupBy.count` when using numpy < 1.13 and ngroups=0 (:issue:`21956`).
3635
-
3736

3837
**Conversion**

doc/source/whatsnew/v0.24.0.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,11 @@ Groupby/Resample/Rolling
536536

537537
- Bug in :func:`pandas.core.groupby.GroupBy.first` and :func:`pandas.core.groupby.GroupBy.last` with ``as_index=False`` leading to the loss of timezone information (:issue:`15884`)
538538
- Bug in :meth:`DatetimeIndex.resample` when downsampling across a DST boundary (:issue:`8531`)
539-
-
540-
-
541-
539+
- Bug where ``ValueError`` is wrongly raised when calling :func:`~pandas.core.groupby.SeriesGroupBy.count` method of a
540+
``SeriesGroupBy`` when the grouping variable only contains NaNs and numpy version < 1.13 (:issue:`21956`).
542541
- Multiple bugs in :func:`pandas.core.Rolling.min` with ``closed='left'` and a
543542
datetime-like index leading to incorrect results and also segfault. (:issue:`21704`)
543+
-
544544

545545
Sparse
546546
^^^^^^

pandas/core/groupby/generic.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
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
5049

5150
from pandas.plotting._core import boxplot_frame_groupby
5251

@@ -1208,10 +1207,7 @@ def count(self):
12081207

12091208
mask = (ids != -1) & ~isna(val)
12101209
ids = ensure_platform_int(ids)
1211-
minlength = ngroups or 0
1212-
if _np_version_under1p13 and minlength == 0:
1213-
minlength = None
1214-
out = np.bincount(ids[mask], minlength=minlength)
1210+
out = np.bincount(ids[mask], minlength=ngroups or None)
12151211

12161212
return Series(out,
12171213
index=self.grouper.result_index,

0 commit comments

Comments
 (0)