-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-7663: [Python] Raise better error message when passing mixed-type (int/string) Pandas dataframe to pyarrow Table #8044
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 all commits
15a22d5
e59eed6
5985d49
80e0078
8f28160
70ae0a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,6 @@ | |
| import decimal | ||
| import itertools | ||
| import math | ||
| import traceback | ||
|
|
||
| import numpy as np | ||
| import pytz | ||
|
|
@@ -382,11 +381,8 @@ def test_sequence_custom_integers(seq): | |
| @parametrize_with_iterable_types | ||
| def test_broken_integers(seq): | ||
|
||
| data = [MyBrokenInt()] | ||
| with pytest.raises(ZeroDivisionError) as exc_info: | ||
| with pytest.raises(pa.ArrowInvalid): | ||
| pa.array(seq(data), type=pa.int64()) | ||
| # Original traceback is kept | ||
| tb_lines = traceback.format_tb(exc_info.tb) | ||
| assert "# MARKER" in tb_lines[-1] | ||
|
|
||
|
|
||
| def test_numpy_scalars_mixed_type(): | ||
|
|
@@ -1643,7 +1639,7 @@ def test_map_from_dicts(): | |
|
|
||
| # Invalid dictionary types | ||
| for entry in [[{'key': '1', 'value': 5}], [{'key': {'value': 2}}]]: | ||
| with pytest.raises(TypeError, match="integer is required"): | ||
| with pytest.raises(pa.ArrowInvalid, match="tried to convert to int"): | ||
| pa.array([entry], type=pa.map_('i4', 'i4')) | ||
|
|
||
|
|
||
|
|
||
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.
What are the cases that this couldn't be converted, but that
objis an integer? When the integer is too big to fit in a C int?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.
Yes, and also when converting a negative integer to a
uint:No other tests are touched if I recompile without this check