Skip to content

BUG: Fix groupby duplicate column error message #8210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use assertTrue; adds ref to GH bug
  • Loading branch information
bthyreau committed Sep 9, 2014
commit 82eb71e01c0c099e2fbfb50a530aaf6e90ced285
11 changes: 6 additions & 5 deletions pandas/tests/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,20 +342,21 @@ def test_groupby_grouper(self):
assert_frame_equal(result, expected)

def test_groupby_duplicated_column(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the issue number as a comment here

# GH7511
df = DataFrame(columns=['A','B','A','C'], \
data=[range(4), range(2,6), range(0, 8, 2)])

grouped = df.groupby('A')
assert grouped.count().index.nlevels == 2
self.assertTrue(grouped.count().index.nlevels == 2)
grouped = df.groupby(['A','B'])
assert grouped.count().index.nlevels == 3
self.assertTrue(grouped.count().index.nlevels == 3)
grouped = df.groupby(['A','A'])
assert grouped.count().index.nlevels == 4
self.assertTrue(grouped.count().index.nlevels == 4)

grouped = df.groupby(['B'])
c = grouped.count()
assert c.columns.nlevels == 1
assert c.columns.size == 3
self.assertTrue(c.columns.nlevels == 1)
self.assertTrue(c.columns.size == 3)

def test_groupby_dict_mapping(self):
# GH #679
Expand Down