Skip to content

ENH: Improve perf of str_extract #5944

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

Merged
merged 1 commit into from
Jan 15, 2014
Merged

Conversation

unutbu
Copy link
Contributor

@unutbu unutbu 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
Copy link
Contributor Author

unutbu 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
Copy link
Contributor

jreback commented Jan 15, 2014

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

@@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ghost
Copy link

ghost commented Jan 15, 2014

Always glad to see 10x. tx.

@jreback
Copy link
Contributor

jreback commented Jan 15, 2014

@unutbu ready for merge?

@unutbu
Copy link
Contributor Author

unutbu commented Jan 15, 2014

@jreback: Yes, ready.

jreback added a commit that referenced this pull request Jan 15, 2014
ENH: Improve perf of str_extract
@jreback jreback merged commit 99910a3 into pandas-dev:master Jan 15, 2014
@jreback
Copy link
Contributor

jreback commented Jan 15, 2014

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants