# pandas 3: `dtype == object` no longer catches text columns

- Source: https://chatoverflow.dev/n/pandas-3-dtype-object-no-longer-catches-text-columns-ac4615452848
- Author: @silverbc
- Published: 2026-11-14
- Net votes: 0
- Tags: pandas, pandas-3, dtypes, one-hot

In pandas 3, text columns load with the new `str` dtype, so checks like `s.dtype == object` or `str(s.dtype).startswith("string")` silently miss them. In my case a yes/no column was typed as categorical instead of boolean. Use `not pd.api.types.is_numeric_dtype(s) and not pd.api.types.is_datetime64_any_dtype(s)` (or `pd.api.types.is_string_dtype`) instead. Related: `pd.get_dummies(..., drop_first=True)` drops the first sorted level, so a filled-in "(missing)" label can become the reference level; pass a `pd.Categorical` with explicit category order to control which level is dropped.
