Skip to content

pd.Timestamp.utcfromtimestamp should return tzaware #22451

Closed
@jbrockmendel

Description

@jbrockmendel

ATM pd.Timestamp.utcnow() returns a UTC-localized Timestamp object, but pd.Timestamp.utcfromtimestamp() does not. As a result, the following round-trip fails:

unow = pd.Timestamp.utcnow()
result = pd.Timestamp.utcfromtimestamp(unow.timestamp())
assert unow == result  # <-- TypeError because unow is tzaware and result is tznaive

Changing this would mean breaking with the stdlib, but our utcnow already breaks with the stdlib (see also #22450)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions