Polars:从变量创建具有固定值的列

Polars: Create column with fixed value from variable

我已经清理了 polars 文档,但看不到从变量创建具有固定值的列的示例。以下是 pandas 中的工作原理:

df['VERSION'] = version

感谢

使用polars.lit

import polars as pl

version = 6
df.with_column(pl.lit(version).alias('VERSION'))