IM尝试使用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:名称“ PylazyFrame”未定义
视图:
问题是Python版本