Table Of Contents

Search

Enter search terms or a module, class or function name.

pandas.Timestamp.tz_localize

Timestamp.tz_localize

Convert naive Timestamp to local time zone, or remove timezone from tz-aware Timestamp.

Parameters:

tz : str, pytz.timezone, dateutil.tz.tzfile or None

Time zone for time which Timestamp will be converted to. None will remove timezone holding local time.

ambiguous : bool, ‘NaT’, default ‘raise’

  • bool contains flags to determine if time is dst or not (note that this flag is only applicable for ambiguous fall dst dates)
  • ‘NaT’ will return NaT for an ambiguous time
  • ‘raise’ will raise an AmbiguousTimeError for an ambiguous time

errors : ‘raise’, ‘coerce’, default ‘raise’

  • ‘raise’ will raise a NonExistentTimeError if a timestamp is not

    valid in the specified timezone (e.g. due to a transition from or to DST time)

  • ‘coerce’ will return NaT if the timestamp can not be converted into the specified timezone

    New in version 0.19.0.

Returns:
localized : Timestamp
Raises:

TypeError

If the Timestamp is tz-aware and tz is not None.

Scroll To Top