Skip to content

Reference

Operations

Every operation that changes the schema of a frame has a hook. Each hook computes the result schema from the schema of the input, or reports why it cannot. The operation catalog of the specification gives the rule of each call.

OperationWhat the checker computes and checks
select, select_seqThe columns of the expressions. Each name exists, and no two results share a name.
with_columns, with_columns_seqThe columns of the frame, with each result added or replaced.
drop, removeThe columns that are left. Each dropped name exists.
renameThe new names. Each old name exists, and no two results share a name.
filterThe same columns. The condition is a Boolean.
join, join_asof, join_whereThe columns of both sides, with the suffix on a right column whose name is also a left column. The keys have data types that join.
group_by(...).agg(...) and the shorthandsThe keys and one column for each aggregation.
rolling(...).agg(...), group_by_dynamic(...).agg(...)The keys, the boundaries, the index and the aggregations. The index and each duration have a data type that the call accepts.
pivot, unpivot, meltThe reshaped columns.
explode, unnestThe inner data type of a List or an Array, and the fields of a Struct.
pl.concat, hstack, vstack, extend, merge_sortedThe combined columns. The frames agree as each strategy needs. A vertical concat gives the plain frame.
with_row_indexA UInt32 index column first.
fill_null, fill_nanThe data type of each column after the fill.
updateThe columns of the left frame.
map_columnsThe same names. Each mapped column becomes Unchecked.
corrA Float64 column for each input column.
sum, mean, max and the other whole-frame reducersOne row, with the data type that the reducer gives for each column.
df["a"], get_columnA TypedSeries with the name and the data type of the column.
pl.selectThe columns of the expressions, over no frame.
lazy(), collect()The same schema, as a LazyFrame or as a DataFrame.
pl.read_*, pl.scan_*, pl.from_* with schema=A typed frame with the given schema.

An operation that keeps the columns, for example sort, head, tail, unique or sample, keeps the schema.

The expressions inside the operations are typed with the typing rules of Polars. See Expressions and data types.