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
3 changes: 3 additions & 0 deletions python/cudf/cudf/core/accessors/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from cudf.api.extensions import no_default
from cudf.api.types import is_integer, is_scalar
from cudf.core.accessors.base_accessor import BaseAccessor
from cudf.core.accessors.lists import ListMethods
from cudf.core.column.column import ColumnBase, as_column, column_empty
from cudf.core.dtypes import ListDtype
from cudf.options import get_option
Expand Down Expand Up @@ -2313,6 +2314,8 @@ def get(self, i: int = 0) -> Series | Index:
2 f
dtype: object
"""
if isinstance(self._column.dtype, ListDtype):
return ListMethods(self._parent).get(i)
str_lens = self.len()
if i < 0:
next_index = i - 1
Expand Down
15 changes: 15 additions & 0 deletions python/cudf/cudf/tests/series/accessors/test_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -2844,3 +2844,18 @@ def test_string_misc_name(ps_gs, name):
assert_eq(ps + ps, gs + gs)
assert_eq(ps + "RAPIDS", gs + "RAPIDS")
assert_eq("RAPIDS" + ps, "RAPIDS" + gs)


def test_string_list_get_access():
ps = pd.Series(["a,b,c", "d,e,f", None, "g,h,i"])
gs = cudf.from_pandas(ps)

expect = ps.str.split(",")
got = gs.str.split(",")

assert_eq(expect, got)

expect = expect.str.get(1)
got = got.str.get(1)

assert_eq(expect, got)
Loading