File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -251,13 +251,13 @@ def use_dynamic_x(ax: Axes, index: Index) -> bool:
251251 return index [:1 ].is_normalized
252252 period = Period (index [0 ], freq_str )
253253 assert isinstance (period , Period )
254+ period_naive = period .to_timestamp ()
254255 if index .tz is not None :
255256 # Compare naive local times directly
256- period_naive = period .to_timestamp ()
257- index_naive = index [0 ].tz_localize (None ) # Strips tz, keeps local time
258- return period_naive == index_naive
257+ tz_naive = index [0 ].tz_localize (None ) # Strips tz, keeps local time
258+ return period_naive == tz_naive
259259 else :
260- return period . to_timestamp () == index [0 ]
260+ return period_naive == index [0 ]
261261
262262 return True
263263
Original file line number Diff line number Diff line change @@ -1003,3 +1003,19 @@ def test_bar_line_plot(self):
10031003 x_limits = ax .get_xlim ()
10041004 assert x_limits [0 ] <= bar_xticks [0 ].get_position ()[0 ]
10051005 assert x_limits [1 ] >= bar_xticks [- 1 ].get_position ()[0 ]
1006+
1007+ def test_tseries_plot_dst_transition (self ):
1008+ """
1009+ Test that plotting tz-aware timeseries works during DST fall-back transition.
1010+ #62936
1011+ """
1012+ tind = pd .date_range (
1013+ "2025-10-26T00:00:00Z" ,
1014+ "2025-10-26T03:00:00Z" ,
1015+ freq = "5min" ,
1016+ tz = "utc" ,
1017+ ).tz_convert ("MET" )[12 :]
1018+
1019+ myts = DataFrame ({"a" : 1 }, index = tind )
1020+ _check_plot_works (myts .plot )
1021+
You can’t perform that action at this time.
0 commit comments