Skip to main content

Module csv

Module csv 

Source
Expand description

Tables as delimited text: CSV (RFC 4180) and its tab-separated variant.

Every parser in the family records a merged cell once, on the cell that owns it: the positions it covers — the tail of a horizontal span, and the columns a vertical span occupies in the rows below — have no cell of their own. Laying such a table on its grid, and quoting the fields so a spreadsheet or a CSV reader gets the values back, are the same work whatever the document format was, so it is done here once.

The layout: a merged cell’s text sits at its top-left position and the positions it covers are empty, so every record has the same number of fields and no value is counted twice (the shape pandas reads as one value and blanks). Rows are written as given — a table’s header rows first, as they are.

std-only, like the rest of the crate root.

Structs§

Cell
One cell of a table row as the family’s models record it: its text, and how many rows and columns it owns. A span of 0 is read as 1.

Functions§

to_csv
The table as CSV: one record per row, fields separated by ,, records ended by CRLF (RFC 4180 §2). See to_delimited.
to_delimited
The table as delimited text with delimiter between fields ('\t' for TSV), laid out on its grid as the module describes.