使用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
相关产品推荐
相关产品推荐

