Код: Выделить всё
import polars as pl
df = pl.DataFrame({
'lst': [[0, 1], [9, 8]],
'val': [3, 4]
})
Код: Выделить всё
┌───────────┬─────┐
│ lst ┆ val │
│ --- ┆ --- │
│ list[i64] ┆ i64 │
╞═══════════╪═════╡
│ [3, 4] ┆ 3 │
│ [13, 12] ┆ 4 │
└───────────┴─────┘
Код: Выделить всё
new_df = df.with_columns(
pl.col('lst').list.eval(pl.element() + 2)
)
Код: Выделить всё
new_df = df.with_columns(
pl.col('lst').list.eval(pl.element() + pl.col('val'))
)
Код: Выделить всё
polars.exceptions.ComputeError: named columns are not allowed in `list.eval`; consider using `element` or `col("")`
Заранее спасибо.
Подробнее здесь: https://stackoverflow.com/questions/779 ... -in-polars