Fix lazy dataframe reindexing with unloaded annotation indexes - #2565
Open
ShreyanshGoyal wants to merge 1 commit into
Open
Fix lazy dataframe reindexing with unloaded annotation indexes#2565ShreyanshGoyal wants to merge 1 commit into
ShreyanshGoyal wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2565 +/- ##
==========================================
- Coverage 87.81% 85.87% -1.95%
==========================================
Files 49 49
Lines 7799 7803 +4
==========================================
- Hits 6849 6701 -148
- Misses 950 1102 +152
|
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.
pandas>=3breaks withxarray.Datasetinobsm/varmwhen usinganndata.concatandload_annotation_index#2475Summary
Fix lazy concatenation of dataframe annotations when load_annotation_index=False and the datasets require outer reindexing.
Root cause
Lazy dataframe annotations retain a temporary range index while their real annotation index is stored separately as the true index. Dataset2D.reindex aligned against that temporary range index. With pandas 3 string dtypes, xarray then attempted to fill the string index variable with np.nan and raised DTypePromotionError.
Reindexing now works on a shallow copy whose computational index has first been switched to the true annotation index. The original lazy dataset remains unchanged.
Test plan
pandas>=3breaks withxarray.Datasetinobsm/varmwhen usinganndata.concatandload_annotation_index#2475 on current main