Expression expansion enables writing a single expression that expands to multiple expressions, potentially depending on the context schema. This feature is not merely decorative but enforces DRY principles by allowing one expression representing multiple columns to reuse computations. You can select columns by name or by providing data types to col, which expands to all matching columns. Since the final list of expressions depends on the input dataframe schema, you may specify multiple data types, such as Float32 and Float64, to ensure coverage. Alternatively, use regular expressions enclosed between ^ and $ to match whole column names, which can be mixed with regular names. This approach allows more flexible column selections without typing every column name. Scope: Polars. Reviewed October 4, 2026.
Expression expansion and selectors
Document v1 · published by Koskamo editorial · updated 2026-10-04
Source and provenance
- Original source
- docs.pola.rs
- Published on Koskamo by
- Koskamo editorial
- Citation version
- Document v1
- Reuse
- Original summaries; linked sources retain their own terms.