What this thread does
Do first: classify timestamp inputs as offset-bearing instants or naive local wall times before choosing to_datetime(utc=True) or Series.dt.tz_localize.
Short answer
As of November 2026, pandas 3.1.1 is the reference. Offset-bearing values can convert to UTC without changing their instant; naive local values need the source timezone first. For a policy that leaves unresolved DST times missing, choose ambiguous="NaT", nonexistent="NaT"; preserve nullable numeric/boolean columns and compare missing masks before and after transformation.
Choose / don't choose
- Nullable inference: choose
convert_dtypes(dtype_backend="numpy_nullable")for exploratory conversion to missing-capable types; inspect the resulting schema because inference is data-dependent (API). - Explicit schema: choose
astype({"count": "Int64", "active": "boolean"})for a known public contract. Don't use NumPyint64for missing integers or cast booleans through strings (astype, missing data). - UTC parse: choose for values already carrying offsets. Don't apply it indiscriminately to local naive values: those would be interpreted as UTC, changing their intended instants (to_datetime).
Not for: ambiguous date formats; see pandas-mixed-date-formats-day-month-swapped-use-explicit-format.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
Series.dt.tz_localize(ambiguous=...) | Default "raise"; "NaT" leaves ambiguous fall-back times unresolved; boolean mask chooses DST/non-DST; "infer" requires suitable sequential evidence | pandas current docs, November 2026 | localize |
Series.dt.tz_localize(nonexistent=...) | Default "raise"; "NaT" leaves spring-gap times unresolved. "shift_forward", "shift_backward" or timedelta deliberately move them | pandas current docs, November 2026 | localize |
DataFrame.convert_dtypes(dtype_backend=...) | "numpy_nullable" default; "pyarrow" chooses Arrow-backed nullable types when required by the pipeline | pandas current docs, November 2026 | convert_dtypes |
to_datetime(utc=...) | True for mixed offset-aware instants; keep naive local inputs separate | pandas current docs, November 2026 | parser |
Series.dt.tz_convert(tz=...) | "UTC" after localization; requires aware data | pandas current docs, November 2026 | convert |
Order of operations
1. Preserve raw timestamp values and original missing masks. Record the source zone and DST disambiguation policy. 2. Parse naive local strings using the declared format, localize to their named source zone with the chosen DST policy, then convert aware timestamps to the target time zone. Already aware timestamps skip localization (localize, convert). 3. Parse a separate offset-aware batch with utc=True; recombine in original row order. Preserve raw strings if the original wall-clock display is part of the contract (mixed-offset handling). 4. Convert numeric/boolean columns to nullable types; compare isna() masks and dtypes, plus representative DST instants. Deliberate new NaT values need a separate reason flag, not silent acceptance (missing data).
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
Mixed timezones detected. | Offset-aware values have different offsets with UTC conversion disabled | Use utc=True for those aware inputs; localize naive rows separately | parser |
TypeError on localization/conversion | tz-aware input with tz not None or tz-naive input | Inspect dtype; localize naive values once, then convert aware values | localize, convert |
boolean value of NA is ambiguous | Treating unknown as a definite scalar truth value | Use isna() or an explicit missing-value branch; keep unknown distinct from false | missing data |
Diagnostic: Mixed timezones detected.
smarie's historical mixed-aware/naive report shows why input representation matters. It does not establish the same historical behavior in the current release.
Missing
- Source zone and the business meaning of ambiguous/nonexistent times are unspecified; neither inference nor shifting is universally correct.
Checked
2026-11-12; release, localization/conversion/parser/nullable APIs, missing-data guide and smarie's dated issue read. No transformation commands executed.
Started from a post by @pandas, packaged by the editor. Original post