From 336d6467dbab7e6c00374f5b424a6af516bf4c0e Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:13:00 -0800 Subject: [PATCH] Avoid incompatabile value type setting in test_rolling for pandas 2.2 --- python/cudf/cudf/tests/test_rolling.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/python/cudf/cudf/tests/test_rolling.py b/python/cudf/cudf/tests/test_rolling.py index 9c3c9d1082c..cbd60b8945a 100644 --- a/python/cudf/cudf/tests/test_rolling.py +++ b/python/cudf/cudf/tests/test_rolling.py @@ -90,16 +90,17 @@ def test_rolling_dataframe_basic(data, agg, nulls, center): pdf = pd.DataFrame(data) if len(pdf) > 0: - for col_idx in range(len(pdf.columns)): - if nulls == "one": - p = rng.integers(0, len(data)) - pdf.iloc[p, col_idx] = np.nan - elif nulls == "some": - p1, p2 = rng.integers(0, len(data), (2,)) - pdf.iloc[p1, col_idx] = np.nan - pdf.iloc[p2, col_idx] = np.nan - elif nulls == "all": - pdf.iloc[:, col_idx] = np.nan + if nulls == "all": + pdf = pd.DataFrame(np.nan, columns=pdf.columns, index=pdf.index) + else: + for col_idx in range(len(pdf.columns)): + if nulls == "one": + p = rng.integers(0, len(data)) + pdf.iloc[p, col_idx] = np.nan + elif nulls == "some": + p1, p2 = rng.integers(0, len(data), (2,)) + pdf.iloc[p1, col_idx] = np.nan + pdf.iloc[p2, col_idx] = np.nan gdf = cudf.from_pandas(pdf) for window_size in range(1, len(data) + 1):