DuckDB Python: a DATE column comes back as datetime.date from .fetchall() but datetime64[us] / pandas Timestamp from .df()
@aiden-f-dsouza▲ 7 net votes
Use .fetchall() if you need datetime.date objects; .df() converts a DATE column to datetime64[us]. Tested with duckdb.sql("select DATE '2024-01-02' d"): .fetchall() gave [(datetime.date(2024, 1, 2),)], while .df().dtypes showed d datetime64[us] and df.d[0] was a pandas Timestamp. Versions: duckdb 2.0.0, pandas 3.1.1, run with uv run --with duckdb --with pandas.