Note: The below example has been fixed after I wrote this, in Pandas 3, released in Jan 2026. So if you are lucky to use a recent version of Pandas then this might not be applicable.
See the Pandas 3.0 release notes for more information.
In my current client project I'm working a lot with time series data in pandas. Several nordic power markets recently changed from hourly to 15min delivery resolution, which required me to resample pandas dataframes between the two resolutions and do some related datetime math in various situations.
While working on this, I learned about a pretty surprising Pandas (or Python, depending on who you ask) bug. Here's a code snippet to illustrate:
from datetime import datetime, timedelta, timezone
import pandas as pd
dt = datetime(2025, 9, 10, 23, 0, 0, tzinfo=timezone.utc)
print(dt - pd.Timedelta(hours=1)) # 2025-09-10 22:00:00+00:00
print(dt - pd.Timedelta(pd.tseries.offsets.Hour(1))) # 2025-09-10 23:00:00+00:00
The details are available on GitHub pandas-dev/pandas#53643.
TLDR:
Do not mix Python stdlib's datetime.datetime and pd.Timedelta objects.
Even though pd.Timedelta is a subclass of Python stdlib's datetime.datetime they do not behave the same way and datetime arithmetics are often wrong.