Skip to content

Commit 0af1e55

Browse files
committed
revert casting logic
1 parent d61d4e0 commit 0af1e55

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/groupby.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2776,7 +2776,7 @@ def _transform_fast(self, func):
27762776
func = getattr(self, func)
27772777

27782778
ids, _, ngroup = self.grouper.group_info
2779-
cast = self.size().isnull().any()
2779+
cast = (self.size().fillna(0) > 0).any()
27802780
out = algos.take_1d(func().values, ids)
27812781
if cast:
27822782
out = self._try_cast(out, self.obj)
@@ -3466,7 +3466,7 @@ def _transform_fast(self, result, obj):
34663466
"""
34673467
# if there were groups with no observations (Categorical only?)
34683468
# try casting data to original dtype
3469-
cast = self.size().isnull().any()
3469+
cast = (self.size().fillna(0) > 0).any()
34703470

34713471
# for each col, reshape to to size of original frame
34723472
# by take operation

0 commit comments

Comments
 (0)