-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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 stats.nanmedian more by assuming nans are rare #3396
Conversation
Move nans to end of array instead of creating a new array without them. This is faster under the reasonable assumption that nans are rare.
as 0.14.x branching is delayed I might as well improve it more :)
|
do we want to add a warning in the all nan case? |
+1 for warning on all-nan input |
This PR doesn't really help for readability. How much does this improve performance compared to current master? |
about 30%-40% faster |
Thanks. That's (just) above my "don't care" threshold, so +0.5 on this PR. |
added warnings and improved tests a little |
looks fine to me, even if it's a bit tricky. I don't understand where the time savings are really coming from, we need to create a copy in both cases. Is np.compress so much slower than the new version? |
the gains come from doing the reverse what np.compress does |
Thanks for the explanation. |
ENH: improve stats.nanmedian more by assuming nans are rare
OK time to merge this. Thanks Julian, Josef. |
Move nans to end of array instead of creating a new array without them.
This is faster under the reasonable assumption that nans are rare.