import polars as pl
import turtle_island as ti
= pl.DataFrame(
df "a": [1, 2, 3], "b": ["x", "y", "z"], "c": [4.4, 5.5, 6.6]}
{
)all().first(), pl.all().last())) df.select(ti.bulk_append(pl.
a | b | c |
---|---|---|
i64 | str | f64 |
1 | "x" | 4.4 |
3 | "z" | 6.6 |
Combines multiple Polars expressions using pl.Expr.append() internally.
You may consider rechunking the result of bulk_append()
using pl.Expr.rechunk() for better performance.
exprs : pl.Expr | Iterable[pl.Expr] = ()
One or more pl.Expr
objects passed as separate arguments, or a single iterable containing multiple pl.Expr
objects.
: pl.Expr
A single Polars expression resulting from appending all input expressions.
with_columns()
Context
Because bulk_append()
may change the total number of rows, use it with caution inside with_columns()
.
Append the last value to the first:
In the list namespace, it may be easier to think of each row as an element in a list. Conceptually, you’re working with a pl.Series
, where each row corresponds to one item in the list.
A similar operation applies to lists, where the last element is appended to the first.