basilisp.csv¶
Wrapper functions for csv which reads and writes CSVs.
- fn (read-csv input & {:or {separator ",", quote "\""}, :keys [separator quote]})[source]¶
Returns a lazy sequence of vectors corresponding to the rows of a CSV file.
If
inputis a string, it will be treated as the contents of a CSV. Otherwise, it will be treated as aio.TextIOBase.The reader function supports the following keyword arguments:
- keyword
:separator: the character used as the separator for a fields in a row default is “,”
- keyword
:quote: the quote character used on quoted fields; default is
true
- keyword
- fn (rows->maps rows & {:or {key-fn keyword}, :keys [key-fn]})[source]¶
Returns a lazy sequence mapping over a sequence of CSV data (as vectors) converting them to maps.
The first row will be used as the headers. The
:key-fnkeyword argument names a function which will be used to map over the keys.
- fn (write-csv writer data & {:or {newline :lf, separator ",", quote "\""}, :keys [separator quote newline]})[source]¶
Write a sequence of rows in CSV format to
writer, which should be anio.TextIOBase.The writing function supports the following keyword arguments:
- keyword
:separator: the character used as the separator for a fields in a row default is “,”
- keyword
:quote: the quote character used on quoted fields; default is
true- keyword
:newline: the newline character to use between rows (
:lfor:cr+lf)
- keyword