9 Commits
Author SHA1 Message Date
Antoine Pitrou 11040609fc ARROW-15116: [Python] Expose invalid_row_handler for CSV reader
Closes #12012 from pitrou/ARROW-15116-py-invalid-row-handler

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2021-12-29 17:18:31 +01:00
David Li 0ebed2b9c9 ARROW-12512: [C++][Python][Dataset] Create CSV writer class and add Datasets support
This refactors the CSV write support to expose an explicit CSV writer class, and adds Python bindings and Datasets support.

Closes #10230 from lidavidm/arrow-12512

Authored-by: David Li <li.davidm96@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2021-07-05 16:17:59 +02:00
9a9baf6824 ARROW-2229: [C++][Python] Add WriteCsv functionality.
This offers possibly performance naive CSV writer with
limited options to keep the initial PR down.

Obvious potential improvements to this approach
are:

- Smarter casts for dictionaries
- Arena allocation for intermediate cast results

The implementation also means that for all primitive type
support we might have to fill in gaps in our cast function.

Closes #9504 from emkornfield/csv

Lead-authored-by: Micah Kornfield <emkornfield@gmail.com>
Co-authored-by: emkornfield <micahk@google.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Co-authored-by: Micah Kornfield <micahk@google.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2021-02-25 20:15:54 +01:00
Antoine Pitrou b69482523d ARROW-8711: [Python] Expose timestamp_parsers in csv.ConvertOptions
Closes #7223 from pitrou/ARROW-8711-py-csv-timestamp-parsing

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: François Saint-Jacques <fsaintjacques@gmail.com>
2020-06-03 08:27:17 -04:00
Antoine Pitrou 18872a4441 ARROW-3410: [C++][Python] Add streaming CSV reader.
Only the serial version is implemented for now.

Closes #6764 from pitrou/ARROW-3410-streaming-csv

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: François Saint-Jacques <fsaintjacques@gmail.com>
2020-04-14 11:44:20 -04:00
Antoine Pitrou 412145b8a7 ARROW-5757: [Python] Remove Python 2.7 support
Part of the changes were done using [pyupgrade](https://github.com/asottile/pyupgrade).

Closes #6410 from pitrou/ARROW-5757-py2-goodbye and squashes the following commits:

f0f9f513b <Antoine Pitrou> Address review comments
561ac965c <Antoine Pitrou> ARROW-5757:  Remove Python 2.7 support

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Wes McKinney <wesm+git@apache.org>
2020-02-12 21:37:59 -06:00
Philipp Moritz 207b3507be ARROW-5027: [Python] Python bindings for JSON reader
This PR implements Python bindings for the JSON reader.

Author: Philipp Moritz <pcmoritz@gmail.com>

Closes #4044 from pcmoritz/cython-read-json and squashes the following commits:

1148f43ed <Philipp Moritz> update
465e9d416 <Philipp Moritz> fixes and docstring
d75b02d18 <Philipp Moritz> add tests
b630845a7 <Philipp Moritz> temp commit
aa0aa3f85 <Philipp Moritz> update
b1742b00e <Philipp Moritz> update
9dfc978cf <Philipp Moritz> add absolute imports
c776e0f5e <Philipp Moritz> linting
bb614282b <Philipp Moritz> comment in again
46a8561fe <Philipp Moritz> update
619064571 <Philipp Moritz> update
364971c86 <Philipp Moritz> update
90a3510a8 <Philipp Moritz> update
4edb201f6 <Philipp Moritz> initial work on JSON reader python wrapper
2019-05-27 18:01:27 +02:00
Antoine Pitrou 1f79fafaec ARROW-3407: [C++] Add UTF8 handling to CSV conversion
CSV conversion now has distinct paths for string and binary columns. String columns are UTF8-validated by default, but it can be disabled by setting the `check_utf8` option in `ConvertOptions`.

CSV type inference now first attempts string conversion and falls back on binary if UTF8 validation fails (if it's not disabled).

As for performance, on pure ASCII columns single-threaded reading slows down by ~10% (which can be avoided by setting `check_utf8` to false). Multi-threaded reading does not seem affected here.

Based on PR #2916.

Author: Antoine Pitrou <antoine@python.org>

Closes #2924 from pitrou/ARROW-3407-csv-utf8-conversion and squashes the following commits:

26a812c5c <Antoine Pitrou> ARROW-3407:  Add UTF8 handling to CSV conversion
2018-11-09 17:43:28 -05:00
Antoine Pitrou 5ebab5aace ARROW-25: [C++] Implement CSV reader
This includes:
- a CSV table reader written in C++
- a Python wrapper around the CSV table reader
- simple type inference for CSV values (null -> int64 -> float64 -> binary)
- generic null parsing using Pandas defaults as a baseline
  ("NA", "N/A", "NaN"...)
- some simple syntax parameters for CSV parsing

Not included:
- conversion and typing options
- performance tuning

Author: Antoine Pitrou <antoine@python.org>

Closes #2576 from pitrou/ARROW-25-csv-reader and squashes the following commits:

4ae93b2d5 <Antoine Pitrou> ARROW-25:  Implement CSV reader
2018-10-01 06:30:34 -04:00