Table Of Contents


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



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


tz : str, pytz.timezone, or None

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

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

When clocks moved backward due to DST, ambiguous times may arise. For example in Central European Time (UTC+01), when going from 03:00 DST to 02:00 non-DST, 02:30:00 local time occurs both at 00:30:00 UTC and at 01:30:00 UTC. In such a situation, the ambiguous parameter dictates how ambiguous times should be handled.

  • 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

nonexistent : ‘shift’, ‘NaT’, default ‘raise’

A nonexistent time does not exist in a particular timezone where clocks moved forward due to DST.

  • ‘shift’ will shift the nonexistent time forward to the closest existing time
  • ‘NaT’ will return NaT where there are nonexistent times
  • ‘raise’ will raise an NonExistentTimeError if there are nonexistent times

New in version 0.24.0.

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

  • ‘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). Use nonexistent='raise' instead.

  • ‘coerce’ will return NaT if the timestamp can not be converted into the specified timezone. Use nonexistent='NaT' instead.

    Deprecated since version 0.24.0.

localized : Timestamp


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

Scroll To Top