8000 BUG: add reset logic for Grouper if new obj is passed in (#26564) by alichaudry · Pull Request #29800 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG: add reset logic for Grouper if new obj is passed in (#26564) #29800

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
Prev Previous commit
Next Next commit
BUG: conform to standard test format (#29800)
  • Loading branch information
alichaudry committed Feb 6, 2020
commit 8dea17d94061e29de73c477da87f9d212385d6fd
9 changes: 8 additions & 1 deletion pandas/tests/resample/test_resampler_grouper.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,4 +310,11 @@ def test_same_grouper_on_different_frames():
groupbys = ["type", pd.Grouper(key="date", freq="1D")]

df1.groupby(groupbys).sum()
df2.groupby(groupbys).count()
result = df2.groupby(groupbys).count()

expected = pd.DataFrame({'num1': {('c', Timestamp('2018-02-12 00:00:00', freq='D')): 1,
('d', Timestamp('2018-03-13 00:00:00', freq='D')): 1},
'num2': {('c', Timestamp('2018-02-12 00:00:00', freq='D')): 1,
('d', Timestamp('2018-03-13 00:00:00', freq='D')): 1}})
expected.index.set_names(["type", "date"], inplace=True)
tm.assert_frame_equal(result, expected)
0