Skip to content

Commit cc93fdc

Browse files
jbrockmendelBlake Hawkins
authored and
Blake Hawkins
committed
Stop catching TypeError in _aggregate_item_by_item (pandas-dev#29177)
1 parent 3fbb0bc commit cc93fdc

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

pandas/core/groupby/generic.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -1099,10 +1099,7 @@ def _aggregate_item_by_item(self, func, *args, **kwargs):
10991099

11001100
cast = self._transform_should_cast(func)
11011101
try:
1102-
11031102
result[item] = colg.aggregate(func, *args, **kwargs)
1104-
if cast:
1105-
result[item] = self._try_cast(result[item], data)
11061103

11071104
except ValueError as err:
11081105
if "Must produce aggregated value" in str(err):
@@ -1111,10 +1108,10 @@ def _aggregate_item_by_item(self, func, *args, **kwargs):
11111108
raise
11121109
cannot_agg.append(item)
11131110
continue
1114-
except TypeError as e:
1115-
cannot_agg.append(item)
1116-
errors = e
1117-
continue
1111+
1112+
else:
1113+
if cast:
1114+
result[item] = self._try_cast(result[item], data)
11181115

11191116
result_columns = obj.columns
11201117
if cannot_agg:

0 commit comments

Comments
 (0)