Skip to content

Commit 857e576

Browse files
Revert part "CLN: Catch more specific exceptions in groupby
pandas-dev#27909"
1 parent a84bfc0 commit 857e576

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pandas/core/groupby/grouper.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -607,11 +607,9 @@ def is_in_axis(key) -> bool:
607607

608608
# if the grouper is obj[name]
609609
def is_in_obj(gpr) -> bool:
610-
if not hasattr(gpr, "name"):
611-
return False
612610
try:
613-
return gpr is obj[gpr.name]
614-
except (KeyError, IndexError):
611+
return id(gpr) == id(obj[gpr.name])
612+
except Exception:
615613
return False
616614

617615
for i, (gpr, level) in enumerate(zip(keys, levels)):

0 commit comments

Comments
 (0)