Repository navigation
Keep timezone when selecting one element of a tz-aware index - #11898
Open
ptlnextdoor wants to merge 3 commits into
Open
ptlnextdoor wants to merge 3 commits into
ptlnextdoor wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
ptlnextdoor
force-pushed
the
fix/oss-xarray-9307
branch
from
November 17, 2026 00:27
d8c2d79 to
236a130
Compare
PandasIndexingAdapter._convert_scalar converted a tz-aware pd.Timestamp to a naive np.datetime64, so isel with a scalar dropped the timezone. Return an object 0-d array holding the Timestamp instead. Co-authored-by: Claude <noreply@anthropic.com>
ptlnextdoor
force-pushed
the
fix/oss-xarray-9307
branch
from
November 17, 2026 00:29
236a130 to
514ece3
Compare
Co-authored-by: Claude <noreply@anthropic.com>
This branch has not been deployed
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.
.isel()on a timezone-aware dimension/index causes it to lose timezone information #9307whats-new.rst.isel()with a scalar on a timezone-aware datetime index returned a naive value, so the timezone was lost.PandasIndexingAdapter._convert_scalarturned a tz-awarepd.Timestampinto a naivenp.datetime64. It now keeps theTimestampin a 0-d object array, becausedatetime64cannot hold a timezone.A new regression test in
xarray/tests/test_indexing.pyfails before the fix and passes after it. I also rantest_indexing,test_variable,test_dataarray,test_dataset,test_indexesandtest_coding_times, plus ruff check and format. All pass. I did not run the full suite.AI disclosure: this PR was prepared with AI assistance (Claude, Anthropic).