Код: Выделить всё
import polars as pl
df = pl.from_repr("""
shape: (5, 4)
┌─────────┬──────────┬───────────┬────────────┐
│ red_low ┆ red_high ┆ green_low ┆ green_high │
│ --- ┆ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ i64 ┆ i64 │
╞═════════╪══════════╪═══════════╪════════════╡
│ 1 ┆ 10 ┆ 2 ┆ 20 │
│ 2 ┆ 20 ┆ 3 ┆ 30 │
│ 3 ┆ 30 ┆ 4 ┆ 40 │
│ 4 ┆ 40 ┆ 5 ┆ 50 │
│ 5 ┆ 50 ┆ 6 ┆ 60 │
└─────────┴──────────┴───────────┴────────────┘
""").lazy()
Код: Выделить всё
┌─────────┬──────────┬───────────┬────────────┬─────────┬───────────┐
│ red_low ┆ red_high ┆ green_low ┆ green_high ┆ red_sum ┆ green_sum │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ i64 ┆ i64 ┆ i64 ┆ i64 │
╞═════════╪══════════╪═══════════╪════════════╪═════════╪═══════════╡
│ 1 ┆ 10 ┆ 2 ┆ 20 ┆ 11 ┆ 22 │
│ 2 ┆ 20 ┆ 3 ┆ 30 ┆ 22 ┆ 33 │
│ 3 ┆ 30 ┆ 4 ┆ 40 ┆ 33 ┆ 44 │
│ 4 ┆ 40 ┆ 5 ┆ 50 ┆ 44 ┆ 55 │
│ 5 ┆ 50 ┆ 6 ┆ 60 ┆ 55 ┆ 66 │
└─────────┴──────────┴───────────┴────────────┴─────────┴───────────┘
Код: Выделить всё
PerformanceWarning: Determining the column names of a LazyFrame requires resolving its schema, which is a potentially expensive operation.
Подробнее здесь: https://stackoverflow.com/questions/793 ... -lazyframe