From dd409534513266c2ae40fede1aa1f47d14587273 Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Wed, 15 Jul 2020 08:01:49 -0700 Subject: [PATCH] throw error for MultiIndex.to_arrow() --- python/cudf/cudf/core/multiindex.py | 20 +++----------------- python/cudf/cudf/tests/test_multiindex.py | 13 +++++++++++++ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/python/cudf/cudf/core/multiindex.py b/python/cudf/cudf/core/multiindex.py index 72f867ec145..4895b898288 100644 --- a/python/cudf/cudf/core/multiindex.py +++ b/python/cudf/cudf/core/multiindex.py @@ -780,23 +780,9 @@ def from_tuples(cls, tuples, names=None): return result def to_arrow(self): - """ - Convert to a PyArrow Table. - - Examples - -------- - >>> import cudf - >>> midx = cudf.MultiIndex( - ... levels=[[1, 3, 4, 5], [1, 2, 5]], - ... codes=[[0, 0, 1, 2, 3], [0, 2, 1, 1, 0]], - ... names=["x", "y"], - ... ) - >>> midx.to_arrow() - pyarrow.Table - x: int64 - y: int64 - """ - return self._source_data.to_arrow() + raise NotImplementedError( + "MultiIndex.to_arrow() is not yet implemented" + ) @property def values_host(self): diff --git a/python/cudf/cudf/tests/test_multiindex.py b/python/cudf/cudf/tests/test_multiindex.py index 0f73b38c2c7..2e8250e5cff 100644 --- a/python/cudf/cudf/tests/test_multiindex.py +++ b/python/cudf/cudf/tests/test_multiindex.py @@ -866,3 +866,16 @@ def test_multiindex_values_host(): pmidx = midx.to_pandas() assert_eq(midx.values_host, pmidx.values) + + +def test_multiindex_to_arrow(): + midx = cudf.MultiIndex( + levels=[[1, 3, 4, 5], [1, 2, 5]], + codes=[[0, 0, 1, 2, 3], [0, 2, 1, 1, 0]], + names=["x", "y"], + ) + with pytest.raises( + NotImplementedError, + match=re.escape("MultiIndex.to_arrow() is not yet implemented"), + ): + midx.to_arrow()