-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: pivot/unstack leading to too many items should raise exception #23512
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 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
da25b19
ENH GH20601 raise an error when the number of levels in a pivot table…
anhqle e6c88c1
TST add a test for pivot table large number of levels causing int32 o…
anhqle db2319e
CLN PEP8 compliance
anhqle 6b7b030
ENH catch the int32 overflow error earlier and in two separate places…
anhqle 23dae93
CLN PEP8 compliance
anhqle a69438f
ENH calculate size of the resulting pivot table and raise error if it…
anhqle b44ca16
rebase onto upstream master
anhqle 59678a6
ENH: Raise and catch FloatingPointException due to overflow
sweb 4dbbad7
ENH: use pd.compat for windows check, add comment
sweb fe48db9
Merge remote-tracking branch 'upstream/master' into too_many_items_to…
sweb 263f598
ENH: ValueError on all platforms when max int32 is reached
sweb c0cff5a
Merge remote-tracking branch 'upstream/master' into too_many_items_to…
sweb b96689d
CLN: Added comment for overflow
sweb 241729f
BUG: zero cells should be allowed
sweb a3cdbca
DOC: Added whatsnew entry (#23512)
sweb 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
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
from warnings import catch_warnings, simplefilter | ||
import datetime | ||
import itertools | ||
|
||
import pytest | ||
import pytz | ||
|
||
|
@@ -720,6 +721,14 @@ def test_unstack_unobserved_keys(self): | |
recons = result.stack() | ||
tm.assert_frame_equal(recons, df) | ||
|
||
@pytest.mark.slow | ||
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. same comments as above |
||
def test_unstack_number_of_levels_larger_than_int32(self): | ||
# GH 20601 | ||
df = DataFrame(np.random.randn(2 ** 16, 2), | ||
index=[np.arange(2 ** 16), np.arange(2 ** 16)]) | ||
with pytest.raises(ValueError, match='int32 overflow'): | ||
df.unstack() | ||
|
||
def test_stack_order_with_unsorted_levels(self): | ||
# GH 16323 | ||
|
||
|
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.
why did you change this?
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.
Good question - this is from the original pull request and I did not know what it was for. I will change it back to the way it was.