readCsvText

fnDataFrame readCsvText(const(char)[] text, Schema schema, CsvReadPolicy policy = CsvReadPolicy.init)

Reads a frame from CSV text with an explicit schema.

Parameters

textthe CSV text
schemathe expected columns (by name when policy.hasHeader, by position otherwise)
policythe reading policy

Returns

the frame, one chunk per chunkRows rows.

Throws

DataFrameException with the line on any violation, including

unparsable numbers, unknown header names and short rows.

fnDataFrame readCsvText(const(char)[] text, CsvInferPolicy policy)

Reads a frame from CSV text with an inferred schema (ADR-2026-10-24-19): inferCsvSchema composes the schema (full-scan by default, finite sample opt-in, overrides per column), then the existing reader parses every row under strict field counts. Any cell that is not a member of its column's kind errors with the canonical first-error line, the column name, the cell text and the kind - late data never widens the schema. The explicit-schema overload keeps its behaviour unchanged.

Parameters

textthe CSV text
policythe inference policy

Returns

the frame, one chunk per read.chunkRows rows.

Throws

DataFrameException on any inference or parse violation; a

sampled read appends the sample size to a parse failure.

Example:

auto df = readCsvText("i,f\n1,0.5\n2,1.5\n", CsvInferPolicy.init);
assert(df.height() == 2);
assert(df["f"].toArray!double() == [0.5, 1.5]);