Skip to content

Commit

Permalink
Trap warning introduced by GH14432 in test_groupby_multi_categorical_…
Browse files Browse the repository at this point in the history
…as_index
  • Loading branch information
Jon M. Mease committed Dec 17, 2016
1 parent dd8cba2 commit 63fa128
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pandas/tests/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -6778,9 +6778,19 @@ def test_groupby_multi_categorical_as_index(self):
'B': [101.0, nan, nan, 205.0, nan, nan]},
columns=['cat', 'A', 'B'])

group_columns = ['cat', 'A']

for name in [None, 'X', 'B', 'cat']:
df.index = Index(list("abc"), name=name)
result = df.groupby(['cat', 'A'], as_index=False).sum()

if name in group_columns and name in df.index.names:
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
result = df.groupby(group_columns, as_index=False).sum()

else:
result = df.groupby(group_columns, as_index=False).sum()

tm.assert_frame_equal(result, expected, check_index_type=True)

def test_groupby_preserve_categorical_dtype(self):
Expand Down

0 comments on commit 63fa128

Please sign in to comment.