pandas.Series.dt.fold#

Series.dt.fold[source]#

Indicate whether each wall time is the second occurrence of a repeated time.

When clocks are set back, e.g. at the end of daylight saving time, a span of wall times occurs twice. The elementwise Timestamp.fold, as bool; False for NaT and tz-naive data.

Added in version 3.2.0.

Returns:
numpy.ndarray[bool]

See also

Timestamp.fold

The fold of a single Timestamp.

DatetimeIndex.tz_localize

Accepts ~fold as ambiguous.

Examples

For Series:

>>> s = pd.Series(
...     pd.date_range("2020-11-01 05:00", periods=3, freq="h", tz="UTC")
... ).dt.tz_convert("America/New_York")
>>> s
0   2020-11-01 01:00:00-04:00
1   2020-11-01 01:00:00-05:00
2   2020-11-01 02:00:00-05:00
dtype: datetime64[us, America/New_York]
>>> s.dt.fold
0    False
1     True
2    False
dtype: bool

For DatetimeIndex:

>>> idx = pd.DatetimeIndex(s)
>>> idx.fold
array([False,  True, False])