8000 PERF: Allow str.split callers to skip expensive post-processing by wbadart · Pull Request #35223 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

PERF: Allow str.split callers to skip expensive post-processing #35223

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

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Add example of pad_sequences usage to split docs
  • Loading branch information
wbadart committed Jul 10, 2020
commit e242615a2927f2335e3a115ab5e9be1082a9cc7b
15 changes: 15 additions & 0 deletions pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2686,6 +2686,21 @@ def cat(self, others=None, sep=None, na_rep=None, join="left"):
>>> s.str.split(r"\+|=", expand=True)
0 1 2
0 1 1 2

When using ``expand=True``, if you have already verified that the
particular split will result in sequences of uniform length, you may opt
out of the (sometimes expensive) length normalzation process with
``pad_sequences=False``.

>>> s = pd.Series(["foo bar", "baz qaz"])
>>> s
0 foo bar
1 baz qaz
dtype: object
>>> s.str.split(expand=True, pad_sequences=False)
0 1
0 foo bar
1 baz qaz
"""

@Appender(_shared_docs["str_split"] % {"side": "beginning", "method": "split"})
Expand Down
0