DuckDB 2 · From Python

Get the result as a DataFrame

Convert a result to pandas, Polars or Arrow. The Polars and Arrow conversions need pyarrow installed.

rel = duckdb.sql("SELECT 1 AS a")
rel.df()      # pandas
rel.pl()      # Polars
rel.arrow()   # Arrow

Official DuckDB 2 documentation

More from python commands

All from python commands · DuckDB 2 cheatsheet

Was this page helpful?