-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Implement arrow string option for various I/O methods #54431
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
3904245
ebe0bd5
0889028
28ace4b
f2b5992
35a8240
b677a89
11b267e
0f79a2f
8072a86
bed3124
efb6f4a
0ac28a1
ff38a29
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 |
---|---|---|
|
@@ -547,15 +547,14 @@ def test_string_inference(all_parsers): | |
|
||
data = """a,b | ||
x,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 add a test case with null/nan/None like in your other PR? 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. I can add a missing field, actually having these values doesn't make much sense 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. Added |
||
y,2""" | ||
y,2 | ||
,3""" | ||
parser = all_parsers | ||
if parser.engine == "pyarrow": | ||
pytest.skip("TODO: Follow up") | ||
with pd.option_context("future.infer_string", True): | ||
result = parser.read_csv(StringIO(data)) | ||
|
||
expected = DataFrame( | ||
{"a": pd.Series(["x", "y"], dtype=dtype), "b": [1, 2]}, | ||
{"a": pd.Series(["x", "y", None], dtype=dtype), "b": [1, 2, 3]}, | ||
columns=pd.Index(["a", "b"], dtype=dtype), | ||
) | ||
tm.assert_frame_equal(result, expected) |
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.
Thinking about this a little, is there a situation where you would want to mix pyarrow and numpy dtypes?
(I'm thinking maybe we should force users to pick the pyarrow dtype backend if you are using the pyarrow string type)
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 there are a lot of situations.
NumPy numeric and Arrow strings is still the fastest, numpy numeric is 2D. Forcing them right now is not a good idea