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

ENH: Improve perf of str_extract #5944

Merged
merged 1 commit into from Jan 15, 2014

Conversation

@unutbu
Copy link
Contributor

commented Jan 15, 2014

Building the result from a list of strings or a list of lists seems to improve performance over building the result via arr.apply(f).

@unutbu

This comment has been minimized.

Copy link
Contributor Author

commented Jan 15, 2014

./test_perf.sh -b master -t str-extract -r extract

Invoked with :
--ncalls: 3
--repeats: 3


-------------------------------------------------------------------------------
Test name                                    | head[ms] | base[ms] |  ratio   |
-------------------------------------------------------------------------------
strings_extract                              |  39.7120 | 578.9154 |   0.0686 |
-------------------------------------------------------------------------------
Test name                                    | head[ms] | base[ms] |  ratio   |
-------------------------------------------------------------------------------

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jan 15, 2014

pls add a note in release notes (u can ref this PR)
in improvements sections
looks good!

@unutbu

View changes

pandas/core/strings.py Outdated
@@ -449,31 +448,27 @@ def f(x):
return None
m = regex.search(x)
if m:
return m.groups()[0] # may be None
return m.groups()[0] or np.nan

This comment has been minimized.

Copy link
@unutbu

unutbu Jan 15, 2014

Author Contributor

m.groups()[0] might return ''. Only None should be turned into NaN. I'll fix this when I get back.

@ghost

This comment has been minimized.

Copy link

commented Jan 15, 2014

Always glad to see 10x. tx.

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jan 15, 2014

@unutbu ready for merge?

@unutbu

This comment has been minimized.

Copy link
Contributor Author

commented Jan 15, 2014

@jreback: Yes, ready.

jreback added a commit that referenced this pull request Jan 15, 2014
Merge pull request #5944 from unutbu/str-extract
ENH: Improve perf of str_extract

@jreback jreback merged commit 99910a3 into pandas-dev:master Jan 15, 2014

1 check passed

default The Travis CI build passed
Details
@jreback

This comment has been minimized.

Copy link
Contributor

commented Jan 15, 2014

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.