CSV: Comma Separated Values
Explore how to read and write CSV files in Rust using the csv crate and Serde for serialization and deserialization. Understand handling flexible CSV data, filtering records, and managing invalid or missing data to efficiently process tabular information.
We'll cover the following...
Comma-separated values (CSV) is a simple format used to exchange tabular data. It also provides a simple way of describing the data it holds
What is CSV?
At the heart of CSV is tabular data, which is data that can be arranged in rows and columns in tables.
The data is arranged in rows. The first row may or may not hold descriptive captions for the columns, called the header. In each row, the cells are separated from each other by commas, hence the name comma-separated values.
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| val. (1,1) |
The data as CSV:
Column 1, Column 2, Column 3 \n
“val. (1,1)”, “val. (1,2)”, “val. (1,2)” \n
“val. (2,1)”, “val. (2,2)”, “val. (2,2)” \ ...