You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Polars执行SQL查询时遭遇NameError: name 'PyLazyFrame' is not defined错误的求助

使用Polars执行SQL查询时遭遇NameError: name 'PyLazyFrame' is not defined错误的求助

我正尝试用SQL语法从Parquet文件中读取数据,以下是我写的代码:

import polars as pl

# Ensure the variables are defined
parquet_file = r'C:\Users\Kperez\Documents\md_curated_20250115.parquet'
date = "2024-12-13"

df3 = pl.read_parquet(parquet_file)

# Register the DataFrame as a table and execute the SQL query
ctx = pl.SQLContext()
ctx.register("data", df3)
result = ctx.execute(f"SELECT Identifier, IQ_CLOSEPRICE FROM data where Date = '{date}'").collect()
print(result)

但运行后触发了如下错误:
NameError: name 'PyLazyFrame' is not defined

报错截图里显示了该错误的完整上下文,包含对应的代码行提示。

有没有人能帮忙分析下原因?

备注:内容来源于stack exchange,提问作者qarly_blue

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 15:52:57