Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ci/test_narwhals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ python -c "import narwhals; print(narwhals.show_versions())"
TESTS_THAT_NEED_NARWHALS_FIX_FOR_CUDF=" \
test_to_numpy[cudf] or \
test_fill_null_strategies_with_limit_as_none[cudf] or \
test_fill_null_series_limit_as_none[cudf] \
test_fill_null_series_limit_as_none[cudf] or \
test_to_datetime_infer_fmt or \
test_to_datetime or \
test_to_datetime_series or \
test_to_datetime_series_infer_fmt \
"

rapids-logger "Run narwhals tests for cuDF"
Expand Down
7 changes: 4 additions & 3 deletions python/cudf/cudf/core/accessors/categorical.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0

from __future__ import annotations
Expand Down Expand Up @@ -419,8 +419,9 @@ def reorder_categories(
dtype: category
Categories (3, int64): [10, 1, 2]
>>> s.cat.reorder_categories([10, 1])
ValueError: items in new_categories are not the same as in
old categories
Traceback (most recent call last):
...
ValueError: items in new_categories are not the same as in old categories
"""
return self._return_or_inplace(
self._column.reorder_categories(new_categories, ordered=ordered),
Expand Down
32 changes: 18 additions & 14 deletions python/cudf/cudf/core/accessors/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ def contains(self, search_key: ScalarLike) -> Series | Index:
--------
>>> s = cudf.Series([[1, 2, 3], [3, 4, 5], [4, 5, 6]])
>>> s.list.contains(4)
Series([False, True, True])
0 False
1 True
2 True
dtype: bool
"""
return self._return_or_inplace(
Expand Down Expand Up @@ -303,16 +305,16 @@ def unique(self) -> Series | Index:
--------
>>> s = cudf.Series([[1, 1, 2, None, None], None, [4, 4], []])
>>> s
0 [1.0, 1.0, 2.0, nan, nan]
1 None
2 [4.0, 4.0]
3 []
0 [1, 1, 2, None, None]
1 None
2 [4, 4]
3 []
dtype: list
>>> s.list.unique() # Order of list element is not guaranteed
0 [1.0, 2.0, nan]
1 None
2 [4.0]
3 []
0 [1, 2, None]
1 None
2 [4]
3 []
dtype: list
"""
if isinstance(
Expand Down Expand Up @@ -354,9 +356,9 @@ def sort_values(
--------
>>> s = cudf.Series([[4, 2, None, 9], [8, 8, 2], [2, 1]])
>>> s.list.sort_values(ascending=True, na_position="last")
0 [2.0, 4.0, 9.0, nan]
1 [2.0, 8.0, 8.0]
2 [1.0, 2.0]
0 [2, 4, 9, None]
1 [2, 8, 8]
2 [1, 2]
dtype: list

.. pandas-compat::
Expand Down Expand Up @@ -406,6 +408,7 @@ def concat(self, dropna: bool = True) -> Series | Index:

Examples
--------
>>> s1 = cudf.Series([[[1.0, 2.0], [3.0, 4.0, 5.0]], [[6.0, None], [7.0], [8.0, 9.0]]])
>>> s1
0 [[1.0, 2.0], [3.0, 4.0, 5.0]]
1 [[6.0, None], [7.0], [8.0, 9.0]]
Expand All @@ -417,6 +420,7 @@ def concat(self, dropna: bool = True) -> Series | Index:

Null values at the top-level in each row are dropped by default:

>>> s2 = cudf.Series([[[1.0, 2.0], None, [3.0, 4.0, 5.0]], [[6.0, None], [7.0], [8.0, 9.0]]])
>>> s2
0 [[1.0, 2.0], None, [3.0, 4.0, 5.0]]
1 [[6.0, None], [7.0], [8.0, 9.0]]
Expand All @@ -429,8 +433,8 @@ def concat(self, dropna: bool = True) -> Series | Index:
Use ``dropna=False`` to produce a null instead:

>>> s2.list.concat(dropna=False)
0 None
1 [6.0, nan, 7.0, 8.0, 9.0]
0 None
1 [6.0, None, 7.0, 8.0, 9.0]
dtype: list
"""
return self._return_or_inplace(
Expand Down
Loading