Skip to content

Commit fdeeb05

Browse files
committed
Comment that BDay deprecation is unnecessary in one case
1 parent 22bae73 commit fdeeb05

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pandas/plotting/_matplotlib/timeseries.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,13 @@ def maybe_convert_index(ax: Axes, data: NDFrameT) -> NDFrameT:
308308
if isinstance(data.index, ABCDatetimeIndex):
309309
data = data.tz_localize(None).to_period(freq=freq_str)
310310
elif isinstance(data.index, ABCPeriodIndex):
311-
data.index = data.index.asfreq(freq=freq_str, how="start")
311+
# This will convert e.g. freq="60min" to freq="min", but will
312+
# retain type(freq). It is not clear to @jbrockmendel why
313+
# this is necessary as of 2025-09-24, but 18 tests fail
314+
# without it.
315+
new_freq = to_offset(freq_str, is_period=True)
316+
assert type(new_freq) is type(data.index.freq)
317+
data.index = data.index.asfreq(freq=new_freq, how="start")
312318
return data
313319

314320

0 commit comments

Comments
 (0)