pathwaycom/pathway · error · ValueError
DateTimeNaive cannot contain timezone information. Use pw.Da
Error message
DateTimeNaive cannot contain timezone information. Use pw.DateTimeUtc for datetimes with a timezone.
What it means
DateTimeNaive is Pathway's pandas.Timestamp subclass that forbids timezone awareness. Its __new__ checks obj.tz after construction and raises if the parsed value carries tzinfo, directing users to DateTimeUtc for timezone-carrying timestamps. This enforces the naive/UTC type distinction used in Pathway's temporal APIs.
Source
Thrown at python/pathway/internals/datetime_types.py:12
# Copyright © 2026 Pathway
import pandas as pd
class DateTimeNaive(pd.Timestamp):
"""Type for storing datetime without timezone information. Extends `pandas.Timestamp` type."""
def __new__(cls, *args, **kwargs):
obj = super().__new__(cls, *args, **kwargs)
if obj.tz is not None:
raise ValueError(
"DateTimeNaive cannot contain timezone information. Use pw.DateTimeUtc for datetimes with a timezone."
)
return obj
class DateTimeUtc(pd.Timestamp):
"""Type for storing datetime with default timezone. Extends `pandas.Timestamp` type."""
def __new__(cls, *args, **kwargs):
obj = super().__new__(cls, *args, **kwargs)
if obj.tz is None:
raise ValueError(
"DateTimeUtc must contain timezone information. Use pw.DateTimeNaive for naive datetimes."
)
return obj
class Duration(pd.Timedelta):View on GitHub (pinned to fa2f74a464)
Solutions
- If times are UTC or zone-aware, change the schema type to pw.DateTimeUtc.
- Strip the timezone before ingestion: pd.to_datetime(series).dt.tz_localize(None) for the naive column.
- Convert to UTC aware for DateTimeUtc: pd.to_datetime(series, utc=True).
Example fix
# before
class Schema(pw.Schema):
ts: pw.DateTimeNaive
df["ts"] = pd.to_datetime(df["ts"], utc=True) # aware -> raises on read
# after
class Schema(pw.Schema):
ts: pw.DateTimeUtc
df["ts"] = pd.to_datetime(df["ts"], utc=True) Defensive patterns
Strategy: validation
Validate before calling
def to_naive(ts: pd.Timestamp) -> pd.Timestamp:
return ts.tz_localize(None) if ts.tz is not None else ts
assert value.tz is None before constructing pw.DateTimeNaive Type guard
import pandas as pd
def is_naive_timestamp(v) -> bool:
return isinstance(v, pd.Timestamp) and v.tz is None Prevention
- Normalize pandas series with dt.tz_localize(None) before writing to DateTimeNaive columns.
- Choose schema type (DateTimeNaive vs DateTimeUtc) based on whether offsets exist in the data.
When it happens
Trigger: pw.DateTimeNaive("2024-01-01T10:00:00+02:00"), pw.DateTimeNaive(pd.Timestamp("2024-01-01", tz="UTC")), or DateTimeNaive.fromtimestamp(ts, tz=...) with a tz; values landing in a DateTimeNaive-typed column from UDFs that return tz-aware timestamps.
Common situations: Schema declares DateTimeNaive but the source data (CSV/kafka ISO strings) includes offsets; pandas parsing with utc=True feeding Pathway; mixing naive and aware timestamps when doing as-of joins.
Related errors
- DateTimeUtc must contain timezone information. Use pw.DateTi
- Unsupported type {input_type}, use pw.DATE_TIME_UTC or pw.DA
- If fmt is not a string, you need to specify whether objects
- Failed to detect the region of S3 bucket {bucket!r} (HTTP st
- SchemaRegistryHeader.value must be a str, got {type(self.val
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/d006c9fbb1946ba2.
Report an issue: GitHub.