PERF: Series.str.get for pyarrow-backed strings by lukemanley · Pull Request #53152 · pandas-dev/pandas (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation2 Commits5 Checks0 Files changed
Conversation
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
[ Show hidden characters]({{ revealButtonHref }})
- Tests added and passed if fixing a bug or adding a new feature
- All code checks passed.
- Added type annotations to new arguments/methods/functions.
- Added an entry in the latest
doc/source/whatsnew/v2.1.0.rst
file if fixing a bug or adding a new feature.
import pandas as pd
import pandas._testing as tm
import pyarrow as pa
N = 1_000_000
ser = pd.Series(tm.makeStringIndex(N), dtype=pd.ArrowDtype(pa.string()))
%timeit ser.str.get(1)
# 70.1 ms ± 3.13 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) -> main
# 37.7 ms ± 2.09 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) -> PR
sort whatsnew entries alphabetically....................................................................Failed
- hook id: sort-whatsnew-items
- duration: 0.04s
- exit code: 1
- files were modified by this hook
pre-commit hook(s) made changes.
If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
To run `pre-commit` as part of git workflow, use `pre-commit install`.
All changes made by hooks:
diff --git a/doc/source/whatsnew/v2.1.0.rst b/doc/source/whatsnew/v2.1.0.rst
index 44ba2ac..a7ad001 100644
--- a/doc/source/whatsnew/v2.1.0.rst
+++ b/doc/source/whatsnew/v2.1.0.rst
@@ -290,10 +290,10 @@ Performance improvements
- Performance improvement in :meth:`.DataFrameGroupBy.groups` (:issue:`53088`)
- Performance improvement in :meth:`DataFrame.loc` when selecting rows and columns (:issue:`53014`)
- Performance improvement in :meth:`Series.corr` and :meth:`Series.cov` for extension dtypes (:issue:`52502`)
+- Performance improvement in :meth:`Series.str.get` for pyarrow-backed strings (:issue:`53152`)
- Performance improvement in :meth:`Series.to_numpy` when dtype is a numpy float dtype and ``na_value`` is ``np.nan`` (:issue:`52430`)
- Performance improvement in :meth:`~arrays.ArrowExtensionArray.to_numpy` (:issue:`52525`)
- Performance improvement when doing various reshaping operations on :class:`arrays.IntegerArrays` & :class:`arrays.FloatingArray` by avoiding doing unnecessary validation (:issue:`53013`)
-- Performance improvement in :meth:`Series.str.get` for pyarrow-backed strings (:issue:`53152`)
-
Rylie-W pushed a commit to Rylie-W/pandas that referenced this pull request
PERF: Series.str.get for pyarrow-backed strings
whatsnew
whatsnew
whatsnew
Daquisu pushed a commit to Daquisu/pandas that referenced this pull request
PERF: Series.str.get for pyarrow-backed strings
whatsnew
whatsnew
whatsnew
2 participants