Cover CategoricalIndex and EA edge cases#11310
Open
alippai wants to merge 3 commits intopydata:mainfrom
Open
Conversation
for more information, see https://pre-commit.ci
Author
|
Cc @ilan-gold |
ilan-gold
reviewed
Apr 23, 2026
Comment on lines
+412
to
+418
| if isinstance( | ||
| condition, pd.api.extensions.ExtensionArray | ||
| ) and pd.api.types.is_bool_dtype(condition.dtype): | ||
| # pandas nullable booleans can contain <NA>, which cannot be cast | ||
| # directly to bool. For masking semantics, treat missing condition | ||
| # values as False. | ||
| condition = condition.fillna(False) |
Contributor
There was a problem hiding this comment.
I would probably just outright error here.
Comment on lines
915
to
924
| if is_allowed_extension_array_dtype(index.dtype): | ||
| return type(self)(index, self.dim) | ||
| coord_dtype = np.result_type(self.coord_dtype, other.coord_dtype) | ||
| try: | ||
| coord_dtype = np.result_type(self.coord_dtype, other.coord_dtype) | ||
| except TypeError: | ||
| # pandas extension dtypes (e.g., CategoricalDtype) are not always | ||
| # compatible with numpy's type promotion even when the resulting | ||
| # index dtype is a regular NumPy dtype. | ||
| coord_dtype = get_valid_numpy_dtype(index) | ||
| return type(self)(index, self.dim, coord_dtype=coord_dtype) |
Contributor
There was a problem hiding this comment.
How is this code reached give the above if is_allowed_extension_array_dtype(index.dtype): guard clause?
Contributor
There was a problem hiding this comment.
@pydata/xarray Is there interest in codecov?
Contributor
There was a problem hiding this comment.
Not sure quite sure what you mean by this. We already have codecov set up https://app.codecov.io/gh/pydata/xarray/pull/11310 (it just doesn't comment on PRs - which I like since I find the bot noisy)
Contributor
There was a problem hiding this comment.
Yeah, I suppose I assumed it was not present. Good to know! I like it for exactly this reason, but now that I know it's here, I'll check :)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Checklist
AI Disclosure