We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e63efa0 commit 9a39fbaCopy full SHA for 9a39fba
pandas/plotting/_matplotlib/timeseries.py
@@ -6,7 +6,6 @@
6
from typing import (
7
TYPE_CHECKING,
8
Any,
9
- cast,
10
)
11
import warnings
12
@@ -271,13 +270,7 @@ def maybe_convert_index(ax: Axes, data: NDFrameT) -> NDFrameT:
271
270
# tsplot converts automatically, but don't want to convert index
272
# over and over for DataFrames
273
if isinstance(data.index, (ABCDatetimeIndex, ABCPeriodIndex)):
274
- freq: str | BaseOffset | None = data.index.freq
275
-
276
- if freq is None:
277
- # We only get here for DatetimeIndex
278
- data.index = cast("DatetimeIndex", data.index)
279
- freq = data.index.inferred_freq
280
- freq = to_offset(freq)
+ freq = _get_index_freq(data.index)
281
282
if freq is None:
283
freq = _get_ax_freq(ax)
0 commit comments