8000 BUG: Fix Grouper with a datetime key in conjunction with another key by juleek · Pull Request #51414 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG: Fix Grouper with a datetime key in conjunction with another key #51414

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

Merged
merged 9 commits into from
Apr 8, 2023
Merged
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
fix conflict
  • Loading branch information
juleek committed Mar 18, 2023
commit a0e5a08479eefb82160d02ec9803a546997cdb86
10 changes: 4 additions & 6 deletions pandas/tests/groupby/test_grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,10 @@ def test_groupby_grouper_f_sanity_checked(self):
msg = "'Timestamp' object is not subscriptable"
with pytest.raises(TypeError, match=msg):
ts.groupby(lambda key: key[0:6])
result = ts.groupby(lambda x: x).sum()
expected = ts.groupby(ts.index).sum()
expected.index.freq = None
tm.assert_series_equal(result, expected)

def test_groupby_with_datetime_key(self):
# GH 51158
Expand All @@ -465,12 +469,6 @@ def test_groupby_with_datetime_key(self):
# test number of group keys
assert len(gb.groups.keys()) == 4

result = ts.groupby(lambda x: x).sum()
expected = ts.groupby(ts.index).sum()
expected.index.freq = None
tm.assert_series_equal(result, expected)


def test_grouping_error_on_multidim_input(self, df):
msg = "Grouper for '<class 'pandas.core.frame.DataFrame'>' not 1-dimensional"
with pytest.raises(ValueError, match=msg):
Expand Down
0