-
Notifications
You must be signed in to change notification settings - Fork 1k
ENH: Expose split_part to Python API via pylibcudf #21068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Umang-projects
wants to merge
28
commits into
rapidsai:main
Choose a base branch
from
Umang-projects:feature/add-split-part
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+158
−9
Open
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
cbab72f
ENH: Implement split_part bindings, API, and tests for pylibcudf and …
Umang-projects 0a824ad
[pre-commit.ci] auto code formatting
pre-commit-ci[bot] 42f7110
Merge branch 'main' into feature/add-split-part
Umang-projects a46bf48
Update python/pylibcudf/pylibcudf/tests/test_split_part.py
Umang-projects 6ad0bae
Update python/cudf/cudf/tests/test_split_part.py
Umang-projects b218452
Update python/pylibcudf/pylibcudf/strings/split/split.pyx
Umang-projects bb44d15
FIX: Add missing split_part declaration in pylibcudf pxd and fixing s…
Umang-projects ab92619
[pre-commit.ci] auto code formatting
pre-commit-ci[bot] 46f1be9
Merge branch 'main' into feature/add-split-part
Umang-projects e9f95dc
STYLE: Fixed String.py
Umang-projects b9f20e0
[pre-commit.ci] auto code formatting
pre-commit-ci[bot] c58353b
Merge branch 'main' into feature/add-split-part
Umang-projects f7e7e8e
Update python/cudf/cudf/core/column/string.py
Umang-projects 705ea28
FIX: Address review comments (add type stubs, fix regression, cleanup…
Umang-projects 82c69a2
[pre-commit.ci] auto code formatting
pre-commit-ci[bot] 17bd7b7
Update python/cudf/cudf/core/accessors/string.py
Umang-projects 0ee4f94
FIX: files
Umang-projects d259e8a
[pre-commit.ci] auto code formatting
pre-commit-ci[bot] 2716fd7
Update python/cudf/cudf/core/accessors/string.py
Umang-projects c03bf2c
Update python/pylibcudf/pylibcudf/strings/split/split.pyx
Umang-projects 01a7852
FIX: Address review comments (Move tests, fix imports, add whitespace…
Umang-projects 694a165
[pre-commit.ci] auto code formatting
pre-commit-ci[bot] f3cb63f
Update python/pylibcudf/pylibcudf/strings/split/split.pyx
Umang-projects cc49475
STYLE: Update copyright years to 2026
Umang-projects b8cf502
Merge branch 'main' into feature/add-split-part
Umang-projects 363917a
Update python/pylibcudf/pylibcudf/strings/split/split.pyx
Umang-projects 7a75d80
Update python/pylibcudf/pylibcudf/strings/split/split.pyx
Umang-projects e5328e4
FIX: Convert delimiter to Scalar
Umang-projects File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2785,6 +2785,40 @@ def rsplit( | |
|
|
||
| return self._return_or_inplace(result_table, expand=expand) | ||
|
|
||
| def split_part( | ||
| self, delimiter: str | None = None, index: int = 0 | ||
| ) -> Series | Index: | ||
| """ | ||
| Splits the string by delimiter and returns the token at the given index. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| delimiter : str, default None | ||
| The string to split on. If not specified, split on whitespace. | ||
| index : int, default 0 | ||
| The index of the token to retrieve. | ||
|
|
||
| Returns | ||
| ------- | ||
| Series or Index | ||
|
|
||
| Examples | ||
| -------- | ||
| >>> import cudf | ||
| >>> s = cudf.Series(["a_b_c", "d_e", "f"]) | ||
| >>> s.str.split_part(delimiter="_", index=1) | ||
| 0 b | ||
| 1 e | ||
| 2 None | ||
| dtype: object | ||
| """ | ||
|
|
||
| if delimiter is None: | ||
| delimiter = "" | ||
| return self._return_or_inplace( | ||
| self._column.split_part(delimiter, index) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the |
||
| ) | ||
|
|
||
| def partition(self, sep: str = " ", expand: bool = True) -> Series | Index: | ||
| """ | ||
| Split the string at the first occurrence of sep. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.