3.1.14 csv
- csv-table-str :: (
- csv-str :: String,
- options :: CSVOptions
- )
- -> TableLoader
Reads CSV data from csv-str with the given options, returning a TableLoader suitable for use with load-table:
include csv animals-data = ``` Pet Name, Age (years), species, fixed Franklin,17,turtle,false Veronica,2,cat,false Ada,10,dog,true ``` check: t = load-table: name, age, species, fixed source: csv-table-str(animals-data, default-options) end t is table: name, age, species, fixed row: "Franklin", 17, "turtle", false row: "Veronica", 2, "cat", false row: "Ada", 10, "dog", true end end
- csv-table-file :: (
- csv-file :: String,
- options :: CSVOptions
- )
- -> TableLoader
Reads CSV data from the file at path csv-path with the given options, returning a TableLoader suitable for use with load-table:
- csv-table-url :: (
- csv-url :: String,
- options :: CSVOptions
- )
- -> TableLoader
Reads CSV data from the url csv-url with the given options, returning a TableLoader suitable for use with load-table:
include csv animals-csv = csv-table-url("https://raw.githubusercontent.com/brownplt/pyret-lang/refs/heads/horizon/tests/io-tests/tests/animals-ds-2024.csv", default-options) animals-table = load-table: name, species, sex, age, fixed, legs, weight, weeks source: animals-csv end check: animals-table.row-n(0)["name"] is "Sasha" animals-table.row-n(0)["species"] is "cat" end
The type of options for processing CSV strings.
The default options for processing CSV strings.
include csv check: default-options is { header-row: true } end