3.1 General-Purpose Libraries
3.1.1 Global Utilities
3.1.2 Numbers
3.1.3 Strings
3.1.4 Booleans
3.1.5 option
3.1.6 either
3.1.7 pick
3.1.8 lists
3.1.9 sets
3.1.10 arrays
3.1.11 string-dict
3.1.12 Tables
3.1.13 gdrive-sheets
3.1.14 csv
3.1.15 color
3.1.16 The image libraries
3.1.17 reactors
3.1.18 chart
3.1.19 plot
3.1.20 statistics
3.1.21 math
3.1.22 matrices
3.1.23 Timing
3.1.24 fetch
On this page:
csv-table-str
csv-table-file
csv-table-url
CSVOptions
default-options
3.1.14 csv🔗

Usage:
include csv
import csv as ...

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:

Examples:

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:

Examples:

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

CSVOptions = {header-row :: Boolean}

The type of options for processing CSV strings.

The default options for processing CSV strings.

Examples:

include csv check: default-options is { header-row: true } end