From 57dce88fa9b7e5b5113c668e7edb93811f958512 Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Mon, 20 Oct 2025 16:09:39 +0000 Subject: [PATCH 1/4] Add nans_to_nulls for MultiIndex --- python/cudf/cudf/core/frame.py | 12 ++++++++++++ .../tests/dataframe/methods/test_sort_values.py | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/python/cudf/cudf/core/frame.py b/python/cudf/cudf/core/frame.py index bb9201326a2..fdcdeff7fce 100644 --- a/python/cudf/cudf/core/frame.py +++ b/python/cudf/cudf/core/frame.py @@ -181,6 +181,18 @@ def deserialize(cls, header, frames): ) return cls._from_data(col_accessor) + @_performance_tracking + def nans_to_nulls(self): + result = [] + for col in self._columns: + converted = col.nans_to_nulls() + if converted is col: + converted = converted.copy() + result.append(converted) + return self._from_data_like_self( + self._data._from_columns_like_self(result) + ) + @classmethod @_performance_tracking def _from_data(cls, data: MutableMapping) -> Self: diff --git a/python/cudf/cudf/tests/dataframe/methods/test_sort_values.py b/python/cudf/cudf/tests/dataframe/methods/test_sort_values.py index 8afef413e7c..428cf900c32 100644 --- a/python/cudf/cudf/tests/dataframe/methods/test_sort_values.py +++ b/python/cudf/cudf/tests/dataframe/methods/test_sort_values.py @@ -228,3 +228,17 @@ def test_dataframe_loc_duplicate_index_scalar(): gdf_sorted = gdf.sort_values(by=list(gdf.columns), axis=0) assert_eq(pdf_sorted, gdf_sorted) + + +def test_dataframe_sort_values_multindex(): + df = cudf.DataFrame( + {"a": [2, 1, 2, 1], "b": [1, 2, 1, 2], "c": [4, 3, 2, 1]} + ) + df = df.set_index(["a", "b"]) + pdf = df.to_pandas() + + expected = pdf.sort_values(by="a", ascending=True) + with cudf.option_context("mode.pandas_compatible", True): + result = df.sort_values(by="a", ascending=True) + + assert_eq(expected, result) From 7f41e0044ba5a81819a1a74a6da13b9277c4c656 Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Mon, 20 Oct 2025 19:13:24 +0000 Subject: [PATCH 2/4] use super class method --- python/cudf/cudf/core/indexed_frame.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/python/cudf/cudf/core/indexed_frame.py b/python/cudf/cudf/core/indexed_frame.py index be37a3a8543..f570a511f32 100644 --- a/python/cudf/cudf/core/indexed_frame.py +++ b/python/cudf/cudf/core/indexed_frame.py @@ -1935,15 +1935,7 @@ def nans_to_nulls(self): 1 3.14 2 """ - result = [] - for col in self._columns: - converted = col.nans_to_nulls() - if converted is col: - converted = converted.copy() - result.append(converted) - return self._from_data_like_self( - self._data._from_columns_like_self(result) - ) + return super().nans_to_nulls() @_performance_tracking def interpolate( From 9a3f85d402b359aa82fc20aac4aaecd35f5483b4 Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Tue, 21 Oct 2025 15:11:56 +0000 Subject: [PATCH 3/4] update --- python/cudf/cudf/pandas/scripts/conftest-patch.py | 1 - .../third_party_integration_tests/tests/test_ibis.py | 1 - 2 files changed, 2 deletions(-) diff --git a/python/cudf/cudf/pandas/scripts/conftest-patch.py b/python/cudf/cudf/pandas/scripts/conftest-patch.py index fc556fd7d8c..c1c78fc4841 100644 --- a/python/cudf/cudf/pandas/scripts/conftest-patch.py +++ b/python/cudf/cudf/pandas/scripts/conftest-patch.py @@ -4422,7 +4422,6 @@ def pytest_unconfigure(config): "tests/frame/methods/test_sort_values.py::TestDataFrameSortValues::test_sort_values_by_empty_list", "tests/frame/methods/test_sort_values.py::TestDataFrameSortValues::test_sort_values_frame_column_inplace_sort_exception", "tests/frame/methods/test_sort_values.py::TestDataFrameSortValues::test_sort_values_item_cache", - "tests/frame/methods/test_sort_values.py::TestSortValuesLevelAsStr::test_sort_index_level_and_column_label[df_idx1-inner-True]", "tests/frame/methods/test_to_csv.py::TestDataFrameToCSV::test_gz_lineend", "tests/frame/methods/test_to_csv.py::TestDataFrameToCSV::test_multi_index_header", "tests/frame/methods/test_to_csv.py::TestDataFrameToCSV::test_to_csv_from_csv1", diff --git a/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_ibis.py b/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_ibis.py index f24c3827100..2b67fa6fd3f 100644 --- a/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_ibis.py +++ b/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_ibis.py @@ -114,7 +114,6 @@ def test_notin(ibis_table_num_str): return t.key.notin([0, 1, 8, 3]).to_pandas() -@pytest.mark.xfail(reason="Failing after Ibis 11 and DuckDB 1.4.0 upgrade") def test_window(ibis_table_num_str): t = ibis_table_num_str return ( From 88891d44712b5e9a44d74e790675f8ad1ea6adb1 Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Tue, 21 Oct 2025 17:43:59 +0000 Subject: [PATCH 4/4] update --- .../third_party_integration_tests/tests/test_ibis.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_ibis.py b/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_ibis.py index 2b67fa6fd3f..9337a121b5e 100644 --- a/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_ibis.py +++ b/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_ibis.py @@ -114,6 +114,7 @@ def test_notin(ibis_table_num_str): return t.key.notin([0, 1, 8, 3]).to_pandas() +@pytest.mark.skip(reason="Failing after Ibis 11 and DuckDB 1.4.0 upgrade") def test_window(ibis_table_num_str): t = ibis_table_num_str return (