-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG GH23744 ufuncs on DataFrame keeps dtype sparseness #23755
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
Merged
Merged
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b85bdb9
BUG-23744 DataFrame.apply keeps dtype sparseness
JustinZhengBC ad33f76
BUG-23744 Fix memory usage
JustinZhengBC c39fe11
BUG-23744 Remove unnecessary check
JustinZhengBC 4aba3f8
BUG-23744 fix import lint
JustinZhengBC bcdf01b
BUG-23744 fix test
JustinZhengBC 79be557
merge
JustinZhengBC 99c8796
BUG-23744 move test and avoid inefficiency
JustinZhengBC 0868c47
Merge master
JustinZhengBC de0ecf3
BUG-23744 make requested changes
JustinZhengBC 491b908
BUG-23744 make requested changes
JustinZhengBC f6230f6
Merge branch 'BUG-23744' of https://github.com/justinzhengbc/pandas i…
JustinZhengBC 42ca43a
Merge branch 'BUG-23744' of https://github.com/justinzhengbc/pandas i…
JustinZhengBC ee2c462
Merge branch 'BUG-23744' of https://github.com/justinzhengbc/pandas i…
JustinZhengBC bca539f
BUG-23744 use list comprehension
JustinZhengBC d8670ef
BUG-23744 use for loop instead
JustinZhengBC 30d83a6
Merge branch 'master' into BUG-23744
JustinZhengBC c15afe3
BUG-23744 fix test
JustinZhengBC b4ab44b
BUG-23744 fix other test
JustinZhengBC d153f74
BUG-23744 use constructor properly
JustinZhengBC d6e22a8
BUG-23744 use block apply
JustinZhengBC 8f151dc
BUG-23744 clarify test
JustinZhengBC be8750f
BUG-23744 clarify test
JustinZhengBC 551ced8
Merge branch 'BUG-23744' of https://github.com/justinzhengbc/pandas i…
JustinZhengBC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,3 +91,14 @@ def test_applymap(frame): | |
# just test that it works | ||
result = frame.applymap(lambda x: x * 2) | ||
assert isinstance(result, SparseDataFrame) | ||
|
||
|
||
def test_apply_keep_sparse_dtype(): | ||
# GH 23744 | ||
expected = SparseDataFrame(np.array([[0, 1, 0], [0, 0, 0], [0, 0, 1]]), | ||
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. can you call this sdf. I find the repeated assignments slightly confusing here. |
||
columns=['b', 'a', 'c'], default_fill_value=1) | ||
result = DataFrame(expected) | ||
|
||
expected = expected.apply(np.exp) | ||
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. expected = sdft.apply(...) |
||
result = result.apply(np.exp) | ||
tm.assert_frame_equal(expected, result) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably need to pass
columns
here to ensure that the columns are in the correct order. Add a test where the columns aren't sorted (like['b', 'a', 'c']
) and verify that it fails on py35 and older.