Skip to content

PERF: fix regression in creation of resulting index in RollingGroupby #38057

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
Prev Previous commit
Next Next commit
cleanup test
  • Loading branch information
jorisvandenbossche committed Nov 30, 2020
commit cf64f2091413a10832fdf0ce2e07f33284982b0c
5 changes: 2 additions & 3 deletions pandas/tests/window/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,16 +426,15 @@ def test_groupby_rolling_empty_frame(self):
# GH 36197
expected = DataFrame({"s1": []})
result = expected.groupby("s1").rolling(window=1).sum()
# GH-38057 from_tupes gives empty object dtype, we now get float/int levels
# expected.index = MultiIndex.from_product([[], []], names=["s1", None])
# GH-38057 from_tuples gives empty object dtype, we now get float/int levels
# expected.index = MultiIndex.from_tuples([], names=["s1", None])
expected.index = MultiIndex.from_product(
[Index([], dtype="float64"), Index([], dtype="int64")], names=["s1", None]
)
tm.assert_frame_equal(result, expected)

expected = DataFrame({"s1": [], "s2": []})
result = expected.groupby(["s1", "s2"]).rolling(window=1).sum()
# expected.index = MultiIndex.from_tuples([], names=["s1", "s2", None])
expected.index = MultiIndex.from_product(
[
Index([], dtype="float64"),
Expand Down