Skip to content

Commit 1da6cf0

Browse files
jbrockmendelNico Cernek
authored and
Nico Cernek
committed
CLN: dont catch Exception in _aggregate_frame (pandas-dev#29194)
1 parent 6e79cb6 commit 1da6cf0

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

pandas/core/groupby/generic.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -1079,15 +1079,8 @@ def _aggregate_frame(self, func, *args, **kwargs):
10791079
else:
10801080
for name in self.indices:
10811081
data = self.get_group(name, obj=obj)
1082-
try:
1083-
fres = func(data, *args, **kwargs)
1084-
except AssertionError:
1085-
raise
1086-
except Exception:
1087-
wrapper = lambda x: func(x, *args, **kwargs)
1088-
result[name] = data.apply(wrapper, axis=axis)
1089-
else:
1090-
result[name] = self._try_cast(fres, data)
1082+
fres = func(data, *args, **kwargs)
1083+
result[name] = self._try_cast(fres, data)
10911084

10921085
return self._wrap_frame_output(result, obj)
10931086

pandas/tests/groupby/test_groupby.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ def test_omit_nuisance(df):
775775

776776
# won't work with axis = 1
777777
grouped = df.groupby({"A": 0, "C": 0, "D": 1, "E": 1}, axis=1)
778-
msg = r'\("unsupported operand type\(s\) for \+: ' "'Timestamp' and 'float'\", 0"
778+
msg = r"unsupported operand type\(s\) for \+: 'Timestamp'"
779779
with pytest.raises(TypeError, match=msg):
780780
grouped.agg(lambda x: x.sum(0, numeric_only=False))
781781

0 commit comments

Comments
 (0)