Skip to content

Commit 9aa9db9

Browse files
jbrockmendelWillAyd
authored andcommitted
catch more specific (#28198)
1 parent 7161b90 commit 9aa9db9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pandas/core/groupby/ops.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,12 @@ def apply(self, f, data, axis=0):
212212
# This Exception is also raised if `f` triggers an exception
213213
# but it is preferable to raise the exception in Python.
214214
pass
215-
except TypeError:
216-
# occurs if we have any EAs
217-
pass
215+
except TypeError as err:
216+
if "Cannot convert" in str(err):
217+
# via apply_frame_axis0 if we pass a non-ndarray
218+
pass
219+
else:
220+
raise
218221

219222
for key, (i, group) in zip(group_keys, splitter):
220223
object.__setattr__(group, "name", key)

0 commit comments

Comments
 (0)