Guides
Loading data
A frame that a reader gives is typed when the call names its schema. Without a schema, Polars finds the data types from the data when the code runs, and the checker cannot know them.
Readers with a schema
Section titled “Readers with a schema”The readers and the constructors that take schema= give a typed frame. A scan_* reader gives a typed lazy frame:
Revealed type
TypedLazyFrame[TypedDict({'symbol': String, 'price': Float64}, closed=True), None]Revealed type
TypedDataFrame[TypedDict({'symbol': String, 'price': Float64}, closed=True), None]These calls read a schema: pl.read_csv, pl.scan_csv, pl.read_parquet, pl.scan_parquet, pl.read_json, pl.read_ndjson, pl.scan_ndjson, pl.from_dict, pl.from_dicts, pl.from_records and pl.from_numpy.
Write the schema in the call
Section titled “Write the schema in the call”The checker reads a dict literal in the call. It does not follow a dict that a variable holds, so the frame stays plain:
DataFrame
To use one schema in several places, declare a Columns class, and check each frame at the boundary with check_schema. See Runtime checks.
Select from a plain frame
Section titled “Select from a plain frame”A plain frame has no known columns. A select on it states the names that the code needs. The checker gives a typed frame with those names: each column keeps the data type of its .cast(...), or takes Unchecked:
Revealed type
TypedDataFrame[TypedDict({'symbol': Unchecked, 'price': Float64}, closed=True), None]The setting elevate_untyped_select controls this, and it is on by default. See Configuration.