Skip to content

Commit

Permalink
Raise error for MultiIndex.to_series
Browse files Browse the repository at this point in the history
  • Loading branch information
galipremsagar committed Sep 6, 2023
1 parent 609f894 commit f338667
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/cudf/cudf/core/multiindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 6 additions & 0 deletions python/cudf/cudf/tests/test_multiindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit f338667

Please sign in to comment.