Код: Выделить всё
import polars as pl
df = pl.DataFrame({
"a": pl.int_range(0,100_000_000,eager=True),
"b": pl.int_range(0,100_000_000,eager=True),
"c": pl.int_range(0,100_000_000,eager=True)}).lazy()
# Method 1
(
df.select(
x_1 = pl.col("a") + pl.col("b"),
x_2 = pl.col("b")+ pl.col("c"))
.select(target = pl.col("x_1") + pl.col("x_2"))
.collect()
)
# Method 2
(
df.select(
target = (pl.col("a") + pl.col("b")) + (pl.col("b")+ pl.col("c"))
)
.collect()
)
Подробнее здесь: https://stackoverflow.com/questions/796 ... ing-select