Table Of Contents

Search

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

pandas.Timestamp.round

Timestamp.round

Round the Timestamp to the specified resolution

Parameters:
freq : a freq string indicating the rounding resolution

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

New in version 0.24.0.

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.

Returns:
a new Timestamp rounded to the given resolution of `freq`
Raises:
ValueError if the freq cannot be converted
Scroll To Top