Skip to content

Commit

Permalink
Add test verifying copy
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Jun 5, 2024
1 parent 4ebcdfa commit be66fde
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/cudf/cudf/core/indexed_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ def nans_to_nulls(self):
converted = col.nans_to_nulls()
if converted is col:
converted = converted.copy()
result.append(col)
result.append(converted)
return self._from_data_like_self(
self._data._from_columns_like_self(result)
)
Expand Down
7 changes: 7 additions & 0 deletions python/cudf/cudf/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2841,3 +2841,10 @@ def test_series_from_series_index_no_shallow_copy():
ser1 = cudf.Series(range(3), index=list("abc"))
ser2 = cudf.Series(ser1)
assert ser1.index is ser2.index


@pytest.mark.parametrize("value", [1, 1.1])
def test_nans_to_nulls_noop_copies_column(value):
ser1 = cudf.Series([value])
ser2 = ser1.nans_to_nulls()
assert ser1._column is not ser2._column

0 comments on commit be66fde

Please sign in to comment.