8000 PERF: fix regression in creation of resulting index in RollingGroupby by jorisvandenbossche · Pull Request #38057 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

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
update test_groupby_rolling_nan_included
  • Loading branch information
jorisvandenbossche committed Nov 30, 2020
commit f785ca4dafc2317fb299b90de4066fd92396d48f
11 changes: 9 additions & 2 deletions pandas/tests/window/test_rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,15 @@ def test_groupby_rolling_nan_included():
result = df.groupby("group", dropna=False).rolling(1, min_periods=1).mean()
expected = DataFrame(
{"B": [0.0, 2.0, 3.0, 1.0, 4.0]},
index=MultiIndex.from_tuples(
[("g1", 0), ("g1", 2), ("g2", 3), (np.nan, 1), (np.nan, 4)],
# GH-38057 from_tuples puts the NaNs in the codes, result expects them
# to be in the levels, at the moment
# index=MultiIndex.from_tuples(
# [("g1", 0), ("g1", 2), ("g2", 3), (np.nan, 1), (np.nan, 4)],
# names=["group", None],
# ),
index=MultiIndex(
[["g1", "g2", np.nan], [0, 1, 2, 3, 4]],
[[0, 0, 1, 2, 2], [0, 2, 3, 1, 4]],
names=["group", None],
),
)
Expand Down
0