select from timestamp column where year greater than 2024
- User
select from timestamp column where year greater than 2024
Assistant
Below are two equivalent ways to pull only the rows whose timestamp column’s year is > 2024 from a Parquet file with DuckDB in Python.
- Pure SQL (works in-memory or on-disk)
pythonimport duckdb conn = duckdb.connect() sql = """ SELECT * FROM 'path/to/data.parquet' WHERE YEAR(ts_column) > 2024; -- ts_column is your TIMESTAMP column """ df = conn.execute(sql).fetchdf() # returns a pandas DataFrame print(df)
- Using
read_parquetwith a filter expression
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.