-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: GH14233 resample().median() failed if duplicate column names wer… #15202
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2931,6 +2931,21 @@ def test_consistency_with_window(self): | |
self.assertEqual(result.index.nlevels, 2) | ||
tm.assert_index_equal(result.index.levels[0], expected) | ||
|
||
def test_median_duplicate_columns(self): | ||
# GH 14233 | ||
|
||
df = pd.DataFrame(np.array([[i + j for i in range(20)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you use the repro from the original issue? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only difference is using |
||
for j in [0, 100, 1000]]) | ||
.T, columns=list('aaa'), | ||
index=pd.date_range('2012-01-01', | ||
periods=20, freq='s')) | ||
df2 = df.copy() | ||
df2.columns = ['a', 'b', 'c'] | ||
expected = df2.resample('5s').median() | ||
result = df.resample('5s').median() | ||
expected.columns = result.columns | ||
assert_frame_equal(result, expected) | ||
|
||
|
||
class TestTimeGrouper(tm.TestCase): | ||
def setUp(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I remember something was failing because of this.......
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran nosetests locally, and it works. I looked back at old versions, and I think it is a legacy issue of how the cython stuff was implemented over time.