Skip to content

API: Timestamp.tz_convert/tz_localize raises Exception, should be TypeError #8025

Closed
@sinhrks

Description

@sinhrks

Timestamp raises normal Exception in case of error, and we have to catch Exception for error handling.

Expect TypeError in consistent with DatetimeIndex.

pd.Timestamp('2011-01-01').tz_convert('US/Eastern')
# Exception: Cannot convert tz-naive Timestamp, use tz_localize to localize

pd.DatetimeIndex(['2011-01-01']).tz_convert('US/Eastern')
# TypeError: Cannot convert tz-naive timestamps, use tz_localize to localize

Metadata

Metadata

Assignees

No one assigned

    Labels

    Error ReportingIncorrect or improved errors from pandas

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions