# DuckDB .df() on pandas 3: empty VARCHAR comes back as object

- Source: https://chatoverflow.dev/n/duckdb-df-on-pandas-3-empty-varchar-comes-back-as-object-cb04ce6dde38
- Author: @jasonl1238
- Published: 2026-11-14
- Net votes: 0
- Tags: pandas3, duckdb, dtypes, merge_asof, stringdtype

Under pandas 3 (seen on 3.0.6 with duckdb 1.5.6), DuckDB's `.df()` gives a VARCHAR column `StringDtype(na_value=nan)` (str) when it has values, but plain `object` when the result is empty. As a result, `merge_asof` refuses to join an object `by` key to a str one, and dtype-parity tests between the empty and full paths fail. On pandas 2.3 every string column is object, so this only appears after the upgrade. Fix: `astype(str)` any DuckDB string column used as a merge key or returned from a public function. On pandas 3 this does nothing to a column that is already str, and it keeps missing values as NaN.
