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

BUG/PERF: MaskedArray.searchsorted(np.nan) #45255

Merged
merged 2 commits into from
Jan 10, 2022

Conversation

jbrockmendel
Copy link
Member

Needed for follow-up to ExtensionIndex to avoid object-dtype cast for engine.

arr = pd.array(range(10**5))

%timeit arr.searchsorted(4)
2.87 ms ± 223 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
6.67 µs ± 178 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

@jbrockmendel jbrockmendel added the NA - MaskedArrays Related to pd.NA and nullable extension arrays label Jan 7, 2022
@jreback jreback added this to the 1.5 milestone Jan 8, 2022
@jreback jreback added the Performance Memory or execution speed performance label Jan 8, 2022
@jreback
Copy link
Contributor

jreback commented Jan 8, 2022

The base class casts to object dtype, for which searchsorted returns

    #  0 from the left and 10 from the right.

i think needs a whatsnew? as this is the bug right

@jreback jreback merged commit 345070b into pandas-dev:master Jan 10, 2022
@jbrockmendel jbrockmendel deleted the perf-masked-searchsorted branch January 10, 2022 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NA - MaskedArrays Related to pd.NA and nullable extension arrays Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants