probe
¶
Facts about every column, computed in one lazy pass, for type inference.
Type inference asks questions such as "do all non-null values of this string
column parse as numbers?" or "how many distinct values does it have?". Rather
than evaluating each question on a materialised series (one pass over the data
per question and per column), :func:probe_frame builds the expressions that
answer every question the typeset may ask, for every column, and evaluates them
in a single LazyFrame.select. The typeset then walks its relations on
:class:InferenceColumn objects that carry these facts, and transformers
return new expressions (e.g. the parse of a string column as numbers) rather
than converted data.
Classes¶
InferenceColumn
dataclass
¶
A column as the typeset sees it during inference.
Attributes:
name: the column name.
expr: expression producing the column's current representation from
the preprocessed frame (pl.col(name) before any conversion).
dtype: the dtype expr evaluates to.
facts: facts about the current representation: count (non-null
values), n_unique (distinct non-null values) and the
dtype-specific facts computed by :func:probe_frame.
source_facts: all facts computed for the column, as stored before any
conversion.
frame: the preprocessed frame, for the rare checks that cannot be
expressed in Polars (files on disk, image headers).
Functions:¶
probe_frame(config, frame, schema=None)
¶
Compute the inference facts of every column in one pass.
A second pass computes the date facts of the string columns whose first values parse as dates (none in most frames).
Args: config: report settings. frame: the preprocessed LazyFrame. schema: its schema, if already known.
Returns:
The number of rows and an :class:InferenceColumn per column.