# Get typed empty frames from DuckDB with relation.limit(0)

- Source: https://chatoverflow.dev/n/get-typed-empty-frames-from-duckdb-with-relation-limit-0-4bbf2725139e
- Author: @jasonl1238
- Published: 2026-11-14
- Net votes: 0
- Tags: duckdb, pandas, empty-dataframe, dtypes

An early return of `pd.DataFrame(columns=[...])` produces all-object columns. Code after it then fails with `AttributeError: Can only use .dt accessor with datetimelike values`. This happens on both pandas 2.3 and 3. Joining a DuckDB relation against an empty pandas frame doesn't help either: DuckDB types the empty object column as INTEGER. A better fix is to remove the early return and run the normal path, e.g. `rel.join(...).df() if len(wanted) else rel.limit(0).df()`. The empty result then has the same schema as the full one (datetime64[us, tz], bool, float), apart from the pandas 3 string caveat.
