Skip to content
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

PERF: Series.str.split(expand=True) for pyarrow-backed strings #53585

Merged
merged 2 commits into from
Jun 12, 2023

Conversation

lukemanley
Copy link
Member

Perf improvement for Series.str.split with expand=True for ArrowDtype(pa.string()):

import pandas as pd
import pyarrow as pa

N = 10_000
data = ["foo|bar|baz"] * N
ser = pd.Series(data, dtype=pd.ArrowDtype(pa.string()))

%timeit ser.str.split("|", expand=True)

# 93.8 ms ± 2.85 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)  -> main
# 5.43 ms ± 201 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)  -> PR

@lukemanley lukemanley added Performance Memory or execution speed performance Strings String extension data type and string data Arrow pyarrow functionality labels Jun 10, 2023
@lukemanley lukemanley added this to the 2.1 milestone Jun 10, 2023
@mroeschke mroeschke merged commit 94a8af5 into pandas-dev:main Jun 12, 2023
@mroeschke
Copy link
Member

Nice! Thanks @lukemanley

@lukemanley lukemanley deleted the str-split-expand-arrow branch June 13, 2023 23:27
canthonyscott pushed a commit to canthonyscott/pandas-anthony that referenced this pull request Jun 23, 2023
…s-dev#53585)

* PERF: Series.str.split(expand=True) for pyarrow-backed

* gh ref
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request Jul 8, 2023
…s-dev#53585)

* PERF: Series.str.split(expand=True) for pyarrow-backed

* gh ref
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrow pyarrow functionality Performance Memory or execution speed performance Strings String extension data type and string data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants