Skip to content

Commit

Permalink
Fix for GH 14334
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon M. Mease committed Oct 20, 2016
1 parent dfd3e09 commit 9805c30
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pandas/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -2208,7 +2208,10 @@ def __init__(self, index, grouper=None, obj=None, name=None, level=None,
index._get_grouper_for_level(self.grouper, level)

else:
if isinstance(self.grouper, (list, tuple)):
if self.grouper is None and self.name is not None:
self.grouper = self.obj[self.name]

elif isinstance(self.grouper, (list, tuple)):
self.grouper = com._asarray_tuplesafe(self.grouper)

# a passed Categorical
Expand Down Expand Up @@ -2448,7 +2451,10 @@ def is_in_obj(gpr):
elif is_in_axis(gpr): # df.groupby('name')
in_axis, name, gpr = True, gpr, obj[gpr]
exclusions.append(name)

elif isinstance(gpr, Grouper) and gpr.key is not None:
# Add key to exclusions
exclusions.append(gpr.key)
in_axis, name = False, None
else:
in_axis, name = False, None

Expand Down

0 comments on commit 9805c30

Please sign in to comment.