Skip to content

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
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