Preserve attrs on Dask DataFrame sample()#1088
Open
LiudengZhang wants to merge 1 commit intoscverse:mainfrom
Open
Preserve attrs on Dask DataFrame sample()#1088LiudengZhang wants to merge 1 commit intoscverse:mainfrom
LiudengZhang wants to merge 1 commit intoscverse:mainfrom
Conversation
Add "sample" to the list of wrapped methods in _accessor.py so that calling .sample() on a Dask DataFrame retains its .attrs metadata, consistent with the other wrapped methods.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1088 +/- ##
=======================================
Coverage 91.96% 91.96%
=======================================
Files 51 51
Lines 7729 7729
=======================================
Hits 7108 7108
Misses 621 621
🚀 New features to boost your workflow:
|
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
DaskDataFrame.sample()does not preserve.attrsmetadata, unlike other wrapped methods (__getitem__,compute,copy,drop,map_partitions,set_index).This adds
"sample"to the list of methods wrapped bywrap_method_with_attrsin_accessor.py, so that.attrsis carried through after calling.sample().Changes
"sample"to the wrapped methods list forDaskDataFrameinsrc/spatialdata/models/_accessor.pytest_dataframe_sample_preserves_attrstest following the existing test patternTest plan
pytest tests/models/test_accessor.py— all 20 tests pass (including new test)