Table.to_csv()

Write the table’s unformatted values to a CSV file.

Usage

Source

Table.to_csv(path)

Parameters

path: str | Path
The file to write.

Examples

Save a table, then read it back with Table.from_csv():

import tempfile
from pathlib import Path

from tinytab import Table

path = Path(tempfile.mkdtemp()) / "menu.csv"
Table({"item": ["coffee", "bagel"], "price": [3.5, 2.25]}).to_csv(path)

print(path.read_text())
item,price
coffee,3.5
bagel,2.25