Skip to content
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

#59009: Added document and a test case for newlines_in_values case. #59754

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

wooseogchoi
Copy link
Contributor

Comment on lines +561 to +563
>>> from pyarrow import csv
>>> parse_options = csv.ParseOptions(newlines_in_values=True)
>>> table = csv.read_csv("example.csv", parse_options=parse_options)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
>>> from pyarrow import csv
>>> parse_options = csv.ParseOptions(newlines_in_values=True)
>>> table = csv.read_csv("example.csv", parse_options=parse_options)
>>> import io
>>> from pyarrow import csv
>>> rows = [{"text": "ab\ncd", "idx": idx} for idx in range(1_000_000)]
>>> df = pd.DataFrame(rows)
>>> source = io.BytesIO(df.to_string(index=False).encode())
>>> parse_options = csv.ParseOptions(newlines_in_values=True)
>>> table = csv.read_csv(source, parse_options=parse_options)

The doctest will fail because "example.csv" does not exist. We can change a bit or just skip the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Reading large CSV files with pyarrow when values contain newline character.
2 participants