df.rolling(): Datetime
How does df.rolling() work with datetime indexes?
Answer
When a DataFrame has a DatetimeIndex, the df.rolling() function can use time-based windows instead of integer sizes.
A time-based window is defined with strings such as "24H", "7D", "30min", "1H" etc.
rolling_24h = df["temperature"].rolling("24h", min_periods=6, step = 24)