From f338667b65ed2b2ce7fca6095d39d3804c38ca9b Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Wed, 6 Sep 2023 11:35:35 -0700 Subject: [PATCH] Raise error for MultiIndex.to_series --- python/cudf/cudf/core/multiindex.py | 6 ++++++ python/cudf/cudf/tests/test_multiindex.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/python/cudf/cudf/core/multiindex.py b/python/cudf/cudf/core/multiindex.py index 12da69740d8..bc6726879c1 100644 --- a/python/cudf/cudf/core/multiindex.py +++ b/python/cudf/cudf/core/multiindex.py @@ -219,6 +219,12 @@ def names(self, value): ) self._names = pd.core.indexes.frozen.FrozenList(value) + @_cudf_nvtx_annotate + def to_series(self, index=None, name=None): + raise NotImplementedError( + "MultiIndex.to_series isn't implemented yet." + ) + @_cudf_nvtx_annotate def astype(self, dtype, copy: bool = True): if not is_object_dtype(dtype): diff --git a/python/cudf/cudf/tests/test_multiindex.py b/python/cudf/cudf/tests/test_multiindex.py index 56bd7d709b7..3c843ace0a8 100644 --- a/python/cudf/cudf/tests/test_multiindex.py +++ b/python/cudf/cudf/tests/test_multiindex.py @@ -1920,3 +1920,9 @@ def test_multiindex_sort_index_partial(levels): expect = df.sort_index(level=levels, sort_remaining=True) got = cdf.sort_index(level=levels, sort_remaining=True) assert_eq(expect, got) + + +def test_multiindex_to_series_error(): + midx = cudf.MultiIndex.from_tuples([("a", "b")]) + with pytest.raises(NotImplementedError): + midx.to_series()