Skip to content

Commit

Permalink
Fix return type of MultiIndex.difference (#14009)
Browse files Browse the repository at this point in the history
closes #14008 

This PR ensures `MultiIndex.difference` returns `cudf.MultiIndex`.

Authors:
  - GALI PREM SAGAR (https://github.com/galipremsagar)

Approvers:
  - Matthew Roeschke (https://github.com/mroeschke)
  - Bradley Dice (https://github.com/bdice)

URL: #14009
  • Loading branch information
galipremsagar authored Aug 30, 2023
1 parent 8978a21 commit 04ee729
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/cudf/cudf/core/multiindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ def memory_usage(self, deep=False):
def difference(self, other, sort=None):
if hasattr(other, "to_pandas"):
other = other.to_pandas()
return self.to_pandas().difference(other, sort)
return cudf.from_pandas(self.to_pandas().difference(other, sort))

@_cudf_nvtx_annotate
def append(self, other):
Expand Down
1 change: 1 addition & 0 deletions python/cudf/cudf/tests/test_multiindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1697,6 +1697,7 @@ def test_difference():

expected = midx2.to_pandas().difference(midx.to_pandas())
actual = midx2.difference(midx)
assert isinstance(actual, cudf.MultiIndex)
assert_eq(expected, actual)


Expand Down

0 comments on commit 04ee729

Please sign in to comment.