NEW
Also known as: Comma Separated Values
A simple delimited text format where fields are separated by commas to represent tabular data.
DESCRIPTION
CSV stores rows of fields separated by commas, optionally quoted to handle embedded commas or newlines. It is human-readable, widely supported, and lacks an explicit schema. Variations in delimiter, quoting, encoding, and header presence can cause interoperability issues. While convenient, CSV is inefficient for large-scale analytics compared to columnar formats like Parquet. RFC 4180 describes a common, though not universal, CSV convention.
ALTERNATIVE DEFINITIONS
Wikipedia
Comma-separated values (CSV) is a delimited text file that uses a comma to separate values.
Highlights file nature and delimiter choice.
IETF RFC 4180
This memo describes the format that is commonly used for the exchange of Comma-Separated Values (CSV) files and proposes a new MIME type, “text/csv”, for CSV files.
Defines common format and registers MIME type text/csv.
Python Documentation
The csv module implements classes to read and write tabular data in CSV format.
Emphasizes practical reading/writing of CSV data.
RELATED TERMS
TSV Delimited Text RFC 4180 Escaping Data Schema Encoding Excel Data Ingestion
COMPETING TERMS
RELATIONS
- Conforms to: RFC 4180
KNOWLEDGE AREAS
Data Integration & Interoperability Data Storage & Operations Data Engineering
TARGET AUDIENCE
Data Engineer Data Analyst BI Specialist Software Developer
EXTERNAL SOURCES
- Wikipedia - Comma-separated values
- Apache Arrow - Efficient CSV reading/writing APIs
- pandas - Dataframe loader for CSV files
- Apache Spark - Distributed CSV data source guide
TOP QUESTIONS
When should I use CSV?
Use CSV for simple tabular data exchange and interoperability, especially when human readability and tool compatibility are priorities.
Category: Guidance
What are CSV’s limitations?
No schema, ambiguous types, encoding issues, and inefficiency for large analytics workloads are common limitations.
Category: Limitations
How do I handle commas inside fields?
Quote fields with embedded commas and escape embedded quotes by doubling them, per RFC 4180 conventions.
Category: HowTo
Is CSV standardized?
CSV has common conventions, with RFC 4180 widely referenced, but implementations vary across tools and locales.
Category: Understanding
How does CSV compare to Parquet?
CSV is row-oriented and text-based; Parquet is columnar and efficient for analytics with compression and schema.
Category: Comparison
What encoding should I use for CSV?
UTF-8 is safest for interoperability, though some tools default to locale-specific encodings.
Category: BestPractice
Can CSV store nested data?
Not naturally. Flatten or serialize nested structures (e.g., JSON strings) at the cost of complexity.
Category: Limitations
How to validate CSV files?
Use schema-on-read tools, header checks, delimiter consistency, and row length validation.
Category: Testing
What delimiter alternatives exist?
TSV (tab-separated) and semicolon-separated formats are common locale-specific alternatives.
Category: Alternatives