-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd
#create a tz-aware date_range with start after European DST change-over
tind = pd.date_range( "2025-10-26T00:00:00Z", "2025-10-26T03:00:00Z", freq="5min", tz="utc" ).tz_convert("MET")[12:]
# result: DatetimeIndex(['2025-10-26 02:00:00+01:00', '2025-10-26 02:05:00+01:00'....
#create a dummy dataset and plot it:
myts = pd.DataFrame( {"a": 1}, index=tind)
# result
# a
# 2025-10-26 02:00:00+01:00 1
# 2025-10-26 02:05:00+01:00 1
# 2025-10-26 02:10:00+01:00 1
# ..
myts.plot()
# raises: AmbiguousTimeError: Cannot infer dst time from 2025-10-26 02:00:00, try using the 'ambiguous' argumentIssue Description
A timezone-aware timeseries which starts after the DST changeover (here: MET 2025-10-26T02:00:00+01:00).
When tried to be plotted, raises AmbiguousTimeError: Cannot infer dst time from 2025-10-26 02:00:00, try using the 'ambiguous' argument. This Exception is usually only rasied if handling non-tz-aware timestamps.
Expected Behavior
no Exception is raised and the timeseries is plotted.
Working example not at DST change edge that shows that usually there is no problem with plotting tz-aware timeseries
import pandas as pd
tind = pd.date_range( "2025-10-25T00:00:00Z", "2025-10-26T03:00:00Z", freq="5min", tz="utc" ).tz_convert("MET")[12:]
myts = pd.DataFrame( {"a": 1}, index=tind)
myts.plot()
Installed Versions
INSTALLED VERSIONS
commit : 9c8bc3e
python : 3.11.4
python-bits : 64
OS : Linux
OS-release : 5.15.0-1089-azure
Version : #98~20.04.1-Ubuntu SMP Fri May 2 20:18:39 UTC 2025
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.3.3
numpy : 2.3.4
pytz : 2025.2
dateutil : 2.9.0.post0
pip : 23.1.2
Cython : None
sphinx : None
IPython : 9.6.0
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : None
lxml.etree : None
matplotlib : 3.10.7
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : None
pyreadstat : None
pytest : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2025.2
qtpy : None
pyqt5 : None