| [ Web Proxy ] |
| Viewing: https://arrow.apache.org/docs/python/generated/pyarrow.csv.write_csv.html | [Back] [Original] |
Section Navigation
Write record batch or table to a CSV file.
pyarrow.RecordBatch or pyarrow.TableThe data to write.
str, path, pyarrow.NativeFile, or file-like objectThe location where to write the CSV data.
pyarrow.csv.WriteOptionsOptions to configure writing the CSV data.
MemoryPool, optionalPool for temporary allocations.
Examples
>>> import pyarrow as pa
>>> from pyarrow import csv
>>> legs = pa.array([2, 4, 5, 100])
>>> animals = pa.array(["Flamingo", "Horse", "Brittle stars", "Centipede"])
>>> entry_date = pa.array(["01/03/2022", "02/03/2022",
... "03/03/2022", "04/03/2022"])
>>> table = pa.table([animals, legs, entry_date],
... names=["animals", "n_legs", "entry"])
>>> csv.write_csv(table, "animals.csv")
>>> write_options = csv.WriteOptions(include_header=False)
>>> csv.write_csv(table, "animals.csv", write_options=write_options)
>>> write_options = csv.WriteOptions(delimiter=";")
>>> csv.write_csv(table, "animals.csv", write_options=write_options)
Copyright 2016-2026 Apache Software Foundation.
Apache Arrow, Arrow, Apache, the Apache logo, and the Apache Arrow project logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.
Created using Sphinx 9.1.0.
Built with the PyData Sphinx Theme 0.20.0.
| Web Proxy Viewer | New URL | Original Page |