-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: fix get_indexer_non_unique() with 'object' targets with NaNs (#4… #44483
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
jreback
merged 1 commit into
pandas-dev:master
from
boschresearch:bugfix/get-indexer-non-unique-object-nans-44482
Nov 26, 2021
Merged
BUG: fix get_indexer_non_unique() with 'object' targets with NaNs (#4… #44483
jreback
merged 1 commit into
pandas-dev:master
from
boschresearch:bugfix/get-indexer-non-unique-object-nans-44482
Nov 26, 2021
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
75ff6b0
to
f4d3b1a
Compare
f4d3b1a
to
1c73fba
Compare
jbrockmendel
approved these changes
Nov 19, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ndas-dev#44482) numpy.searchsorted() does not handle NaNs in 'object' arrays as expected (numpy/numpy#15499). Therefore we cannot search NaNs using binary search. So we use binary search only for targets without NaNs.
1c73fba
to
7e32f0c
Compare
Rebased & resolved conflict |
thanks @johannes-mueller very nice, keep em coming! |
@@ -332,3 +332,12 @@ def test_get_indexer_non_unique_multiple_nans(idx, target, expected): | |||
axis = Index(idx) | |||
actual = axis.get_indexer_for(target) | |||
tm.assert_numpy_array_equal(actual, expected) | |||
|
|||
|
|||
def test_get_indexer_non_unique_nans_in_object_dtype_target(nulls_fixture): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could also test NP_NAT_OBJECTS here
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Bug
Indexing
Related to indexing on series/frames, not to indexes themselves
Missing-data
np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…4482)
numpy.searchsorted() does not handle NaNs in 'object' arrays as
expected (numpy/numpy#15499). Therefore we cannot search NaNs using binary
search. So we use binary search only for targets without NaNs.
This does also put the whatsnew of #44404 to the correct place.