randolf-scholz commented on issue #26404: URL: https://github.com/apache/arrow/issues/26404#issuecomment-1668132718
Another example is when one has a large zip-file containing multiple `.csv.gz` archives. It would be nice to have a `compression` option in `read_csv` or in [`pyarrow.csv.ReadOptions`](https://arrow.apache.org/docs/python/generated/pyarrow.csv.ReadOptions.html#pyarrow.csv.ReadOptions), since pyarrow's `gzip`-decoding seems quite a bit faster than the one provided by python's standard library. ```python with ZipFile("huge_archive.zip", "r") as archive: with archive.open("table.csv.gz") as compressed_file: with gzip.open(compressed_file) as file: da = pa.csv.read_csv(file) ``` vs ```python with ZipFile("huge_archive.zip", "r") as archive: with archive.open("table.csv.gz") as compressed_file: read_options=pa.csv.ReadOptions(compression="gzip") da = pa.csv.read_csv(compressed_file, read_options=read_options) ``` or even ```python with ZipFile("huge_archive.zip", "r") as archive: with archive.open("table.csv.gz") as compressed_file: da = pa.csv.read_csv(compressed_file, compression="gzip") ``` Faster, more readable, less extra imports. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
