-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
BUG: Switched shapes in ValueError msg in DataFrame construct (#20742) #24725
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
Changes from 1 commit
92b0bb3 46d4d55 aa3c5d5 35acafd cdeeacc 31cf4f6 39b8ca9 244621b 4cfae58 7a6cd18 cb282dc File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
TST: adjusted panel test for change in value error msg in block manager TST: adjusted dataframe init test from json for change in value error msg in block manager
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -1673,8 +1673,10 @@ def create_block_manager_from_arrays(arrays, names, axes): | |
| | ||
| def construction_error(tot_items, block_shape, axes, e=None): | ||
| """ raise a helpful message about our construction """ | ||
| passed = tuple(map(int, reversed([tot_items] + list(block_shape)))) | ||
| implied = tuple(map(int, reversed([len(ax) for ax in axes]))) | ||
| passed = tuple(map(int, list(block_shape) + [tot_items])) | ||
| ||
| | ||
| implied = [] if len(axes) == 0 \ | ||
| else [len(ax) for ax in axes[1:] + [axes[0]]] | ||
| if passed == implied and e is not None: | ||
| raise e | ||
| if block_shape[0] == 0: | ||
| | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -1143,23 +1143,11 @@ def test_from_dict_mixed_orient(self): | |
| assert panel['A'].values.dtype == np.float64 | ||
| | ||
| def test_constructor_error_msgs(self): | ||
| msg = (r"Shape of passed values is \(3, 4, 5\), " | ||
| r"indices imply \(4, 5, 5\)") | ||
| msg = (r"Shape of passed values is \(4, 5, 3\), " | ||
| ||
| r"indices imply \(5, 6, 4\)") | ||
| with pytest.raises(ValueError, match=msg): | ||
| Panel(np.random.randn(3, 4, 5), | ||
| lrange(4), lrange(5), lrange(5)) | ||
| | ||
jreback marked this conversation as resolved. Show resolved Hide resolved | ||
| msg = (r"Shape of passed values is \(3, 4, 5\), " | ||
| r"indices imply \(5, 4, 5\)") | ||
| with pytest.raises(ValueError, match=msg): | ||
| Panel(np.random.randn(3, 4, 5), | ||
| lrange(5), lrange(4), lrange(5)) | ||
| | ||
| msg = (r"Shape of passed values is \(3, 4, 5\), " | ||
| r"indices imply \(5, 5, 4\)") | ||
| with pytest.raises(ValueError, match=msg): | ||
| Panel(np.random.randn(3, 4, 5), | ||
| lrange(5), lrange(5), lrange(4)) | ||
| lrange(4), lrange(5), lrange(6)) | ||
| | ||
| def test_conform(self): | ||
| df = self.panel['ItemA'][:-5].filter(items=['A', 'B']) | ||
| | ||
Uh oh!
There was an error while loading. Please reload this page.