Export to Pandas

The result of a query can be converted to a Pandas DataFrame using the df() function.

import duckdb

# read the result of an arbitrary SQL query to a Pandas DataFrame
results = duckdb.sql("SELECT 42").df()
results
42
0  42

See Also

DuckDB also supports importing from Pandas.

© Copyright 2018–2024 Stichting DuckDB Foundation
Licensed under the MIT License.
https://duckdb.org/docs/guides/python/export_pandas.html