-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Add test for #32108 (error with groupby on series with period index) #33105
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 6 commits
74e65a8
fb148f5
a3444fc
0cd603f
35deb44
e6f3884
fd3c0db
4dac36a
7fbfb65
4379fe3
ad9fac6
408da64
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 |
---|---|---|
|
@@ -149,6 +149,18 @@ def test_grouper_index_types(self): | |
df.index = list(reversed(df.index.tolist())) | ||
df.groupby(list("abcde")).apply(lambda x: x) | ||
|
||
def test_grouper_period_index(self): | ||
# GH 32108 | ||
periods = 2 | ||
index = pd.period_range(start="2018-01", periods=periods, freq="M") | ||
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. pass |
||
periodSerie = pd.Series(range(periods), index=index) | ||
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. naming this
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. Done, I hope it's all good now :) |
||
periodSerie.index.name = "Month" | ||
result = periodSerie.groupby(periodSerie.index.month).sum() | ||
|
||
expected = pd.Series(range(0, periods), index=range(1, periods + 1)) | ||
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. you can construct the |
||
expected.index.name = periodSerie.index.name | ||
tm.assert_series_equal(result, expected) | ||
|
||
def test_grouper_multilevel_freq(self): | ||
|
||
# GH 7885 | ||
|
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.
move this to pandas/tests/groupby/test_timegrouper.py