diff --git a/python/cudf/cudf/_lib/copying.pyx b/python/cudf/cudf/_lib/copying.pyx index d9a7a5b8754..f5c910ca77d 100644 --- a/python/cudf/cudf/_lib/copying.pyx +++ b/python/cudf/cudf/_lib/copying.pyx @@ -144,7 +144,7 @@ def copy_range(Column input_column, target_column from target_begin to target_end """ - if abs(target_end - target_begin) <= 1: + if abs(target_end - target_begin) < 1: return target_column if target_begin < 0: diff --git a/python/cudf/cudf/tests/test_setitem.py b/python/cudf/cudf/tests/test_setitem.py index 13b342e6c3b..bbf6f14d99f 100644 --- a/python/cudf/cudf/tests/test_setitem.py +++ b/python/cudf/cudf/tests/test_setitem.py @@ -108,6 +108,12 @@ def test_series_set_item(psr, arg): assert_eq(psr, gsr) +def test_series_setitem_singleton_range(): + sr = cudf.Series([1, 2, 3], dtype=np.int64) + sr.iloc[:1] = np.asarray([7], dtype=np.int64) + assert_eq(sr, cudf.Series([7, 2, 3], dtype=np.int64)) + + @pytest.mark.parametrize( "df", [