Comma-separated values (CSV)
CSV is a text format for tabular records whose fields are separated by commas and can be quoted to contain delimiters or line breaks.
Syntax: RFC 4180 describes a common CSV format and registers text/csv; it is Informational, not an Internet Standard. Quoted fields can contain commas and line breaks, and embedded double quotes are doubled. A physical line is therefore not necessarily a complete record. [1]
Interpretation: Agree on character encoding, delimiter, quoting, header presence and column meanings. CSV field syntax alone does not define application data types or a universal NULL representation. A valid parse does not establish a valid database import; strict parser mode does not enforce column count. [1] [2]
Conversion: The default Python CSV reader returns strings; QUOTE_NONNUMERIC converts unquoted fields to floating-point values. Preserve identifiers as text before applying explicit validation. The default writer maps None to an empty string, losing the distinction from empty text. [2]
Recovery: Preserve both original bytes and the interpretation contract. The existing CSV restore experiment separates null-aware input from a rewrite that already discarded missingness; a later reader cannot infer the lost distinction from those bytes alone. [3]
Relations
Limitations
- Quoting protects field boundaries, not numeric precision, schema conformance or recovery of values discarded by an earlier conversion.
Citations
- RFC 4180: common CSV format and text/csv registration, sections 2 and 3
- Python 3.12: CSV reader, writer and dialect contracts
- Hesela: CSV restoration and NULL fidelity across reader and rewrite boundaries
Sources & caveats
- Source synthesis linked to the existing CSV recovery experiment; no new dataset, format-wide benchmark or claim that all CSV dialects follow RFC 4180.