-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
BUG: boolean indexer with NA raising when reindex is necessary #47623
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
from pandas.core.dtypes.common import ( | ||
is_array_like, | ||
is_bool_dtype, | ||
is_extension_array_dtype, | ||
is_hashable, | ||
is_integer, | ||
is_iterator, | ||
|
@@ -2531,6 +2532,9 @@ def check_bool_indexer(index: Index, key) -> np.ndarray: | |
""" | ||
result = key | ||
if isinstance(key, ABCSeries) and not key.index.equals(index): | ||
if is_extension_array_dtype(result): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think checking the indexer approach may be more robust here instead. Would this hit 3rd party EA dtypes and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this hit in a code path where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agree here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also much more performant to check result.dtype than just result There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Switched to indexer |
||
result[result.values._mask] = False | ||
|
||
result = result.reindex(index) | ||
mask = isna(result._values) | ||
if mask.any(): | ||
|
Uh oh!
There was an error while loading. Please reload this page.