Skip to content

DEPR: Enforce ewm(times=str) deprecation #48842

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 13 commits into from
Oct 21, 2022
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 test
  • Loading branch information
mroeschke committed Sep 29, 2022
commit ec846c49a78531da4089b85556a94b171598d3d0
16 changes: 12 additions & 4 deletions pandas/tests/window/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,11 @@ def test_times(self, times_frame):
halflife = "23 days"
with tm.assert_produces_warning(FutureWarning, match="nuisance"):
# GH#42738
result = times_frame.groupby("A").ewm(halflife=halflife, times="C").mean()
result = (
times_frame.groupby("A")
.ewm(halflife=halflife, times=times_frame["C"])
.mean()
)
expected = DataFrame(
{
"B": [
Expand Down Expand Up @@ -1203,9 +1207,13 @@ def test_times_vs_apply(self, times_frame):
halflife = "23 days"
with tm.assert_produces_warning(FutureWarning, match="nuisance"):
# GH#42738
result = times_frame.groupby("A").ewm(halflife=halflife, times="C").mean()
result = (
times_frame.groupby("A")
.ewm(halflife=halflife, times=times_frame["C"])
.mean()
)
expected = times_frame.groupby("A", group_keys=True).apply(
lambda x: x.ewm(halflife=halflife, times="C").mean()
lambda x: x.ewm(halflife=halflife, times=x["C"]).mean()
)
tm.assert_frame_equal(result, expected)

Expand All @@ -1215,7 +1223,7 @@ def test_times_array(self, times_frame):
gb = times_frame.groupby("A")
with tm.assert_produces_warning(FutureWarning, match="nuisance"):
# GH#42738
result = gb.ewm(halflife=halflife, times="C").mean()
result = gb.ewm(halflife=halflife, times=times_frame["C"]).mean()
expected = gb.ewm(halflife=halflife, times=times_frame["C"].values).mean()
tm.assert_frame_equal(result, expected)

Expand Down