Polars 与 Qust 互操作
Polars 做数据表和前处理,Qust 做状态表达式、参数联动、Monitor 和 Wasm 路径。
import polars as pl
import qust as qs
from qust import col
data = pl.DataFrame({"x": [1.0, 2.0, 3.0], "y": [10.0, 20.0, 30.0]})
# Polars 负责数据承载和预处理
data = data.with_columns((pl.col("x") * 2).alias("x2"))
# Qust 负责表达式执行计划
df = col.with_cols((col("x2") + col("y")).alias("score")).runtime()
print(df.calc_data(data))
# 需要 Polars 命名空间桥接时显式启用
qs.enable_polars_namespace()