From 9b5f56a99021d2230b79bb10c44a4b01562aeeed Mon Sep 17 00:00:00 2001 From: Matthew Murray Date: Thu, 19 Sep 2024 11:53:35 -0700 Subject: [PATCH] fix ewm.mean --- python/cudf/cudf/core/window/ewm.py | 4 ++-- python/cudf/cudf/tests/test_ewm.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/python/cudf/cudf/core/window/ewm.py b/python/cudf/cudf/core/window/ewm.py index ef0f6958aeb..3a5369b17d1 100644 --- a/python/cudf/cudf/core/window/ewm.py +++ b/python/cudf/cudf/core/window/ewm.py @@ -190,8 +190,8 @@ def _apply_agg_series(self, sr, agg_name): # passing them in. to_libcudf_column = sr._column.astype("float64").nans_to_nulls() - return self.obj._from_data_like_self( - self.obj._data._from_columns_like_self( + return sr._from_data_like_self( + sr._data._from_columns_like_self( [ scan( agg_name, diff --git a/python/cudf/cudf/tests/test_ewm.py b/python/cudf/cudf/tests/test_ewm.py index 6cb3c19d5a8..78bf7929471 100644 --- a/python/cudf/cudf/tests/test_ewm.py +++ b/python/cudf/cudf/tests/test_ewm.py @@ -44,3 +44,11 @@ def test_ewma(data, params, adjust): got = gsr.ewm(**params).mean() assert_eq(expect, got) + + gdf = cudf.DataFrame({"foo": data, "bar": data}, dtype="float64") + pdf = gdf.to_pandas() + + expect = gdf.ewm(**params).mean() + got = pdf.ewm(**params).mean() + + assert_eq(expect, got)