From 882b603f35acc657cf57055c1c60bd995efd4ab4 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Wed, 28 Aug 2019 11:15:11 -0700 Subject: [PATCH] catch more specific --- pandas/core/groupby/ops.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pandas/core/groupby/ops.py b/pandas/core/groupby/ops.py index b0c629f017dd3..88f5afb9f3bb0 100644 --- a/pandas/core/groupby/ops.py +++ b/pandas/core/groupby/ops.py @@ -212,9 +212,12 @@ def apply(self, f, data, axis=0): # This Exception is also raised if `f` triggers an exception # but it is preferable to raise the exception in Python. pass - except Exception: - # raise this error to the caller - pass + except TypeError as err: + if "Cannot convert" in str(err): + # via apply_frame_axis0 if we pass a non-ndarray + pass + else: + raise for key, (i, group) in zip(group_keys, splitter): object.__setattr__(group, "name", key)