CSV
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
CSV.type
Members list
Value members
Concrete methods
Reads a CSV file from an absolute path and returns a io.github.quafadas.scautable.CsvIterator.
Reads a CSV file from an absolute path and returns a io.github.quafadas.scautable.CsvIterator.
Almond compiles in-process, so macro expansion happens with the kernel's working directory — and Jupyter starts a kernel with cwd set to the notebook's directory. So Paths.get(...).toAbsolutePath inside the macro resolves against the notebook dir.
Example:
val csv: CsvIterator[("colA", "colB", "colC")] = CSV.absolutePath("/absolute/path/to/file.csv")
Attributes
Reads a CSV from a String and returns a io.github.quafadas.scautable.CsvIterator.
Reads a CSV from a String and returns a io.github.quafadas.scautable.CsvIterator.
Example:
val csvContent = "colA,colB\n1,a\n2,b"
val csv: CsvIterator[("colA", "colB")] = CSV.fromString(csvContent)
Attributes
Creates a function that reads a CSV file from a runtime path and returns a io.github.quafadas.scautable.CsvIterator.
Creates a function that reads a CSV file from a runtime path and returns a io.github.quafadas.scautable.CsvIterator.
Unlike other CSV methods that require the file path at compile time, this method allows you to specify the column types at compile time but provide the file path at runtime. This is useful when you know the structure of a CSV file in advance but the actual file location is determined at runtime.
Example:
val csvReader = CSV.fromTyped[("name", "age", "salary"), (String, Int, Double)]
val data = csvReader(os.pwd / "employees.csv")
// data is a CsvIterator[("name", "age", "salary"), (String, Int, Double)]
Type parameters
- K
-
A tuple of string literal types representing the column names
- V
-
A tuple of types representing the column value types (must have Decoders available)
Attributes
- Returns
-
A function that takes an os.Path and returns a CsvIterator with the specified types
Reads a CSV path relative to the discovered project root.
Reads a CSV path relative to the discovered project root.
In a notebook or REPL there is no source file on disk to search upwards from, so the root is discovered from the working directory instead and a compile time warning says so.
Attributes
Reads a CSV path relative to the source file where this macro is called.
Reads a CSV path relative to the source file where this macro is called.
In a notebook or REPL there is no source file on disk, so the path resolves against the working directory instead and a compile time warning says so.
Attributes
Reads a CSV present in java resources and returns a io.github.quafadas.scautable.CsvIterator.
Reads a CSV present in java resources and returns a io.github.quafadas.scautable.CsvIterator.
Example:
val csv: CsvIterator[("colA", "colB", "colC")] = CSV.resource("file.csv")
Attributes
Saves a URL to a local CSV returns a io.github.quafadas.scautable.CsvIterator.
Saves a URL to a local CSV returns a io.github.quafadas.scautable.CsvIterator.
Example:
val csv: CsvIterator[("colA", "colB", "colC")] = CSV.url("https://somewhere.com/file.csv")