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 73bc6cf commit c30fa2b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pandas/tests/groupby/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,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 c30fa2b

Please sign in to comment.