Skip to content

Commit

Permalink
throw error for MultiIndex.to_arrow()
Browse files Browse the repository at this point in the history
  • Loading branch information
galipremsagar committed Jul 15, 2020
1 parent 90bc016 commit dd40953
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
20 changes: 3 additions & 17 deletions python/cudf/cudf/core/multiindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
13 changes: 13 additions & 0 deletions python/cudf/cudf/tests/test_multiindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit dd40953

Please sign in to comment.