Skip to content

Commit 21b5e1f

Browse files
committed
Adapt existing tests for arbitrary freq PeriodIndex, args formatting updated
1 parent 53441fe commit 21b5e1f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pandas/plotting/_timeseries.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def _maybe_convert_index(ax, data):
282282
if isinstance(data.index, ABCDatetimeIndex):
283283
data = data.to_period(freq=freq)
284284
elif isinstance(data.index, ABCPeriodIndex):
285-
data.index = data.index.asfreq(freq)
285+
data.index = data.index.asfreq(freq=freq)
286286
return data
287287

288288

pandas/tests/plotting/test_datetimelike.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def check_format_of_first_point(ax, expected_string):
211211
@pytest.mark.slow
212212
def test_line_plot_period_series(self):
213213
for s in self.period_ser:
214-
_check_plot_works(s.plot, s.index.freq)
214+
_check_plot_works(s.plot, s.index.freq.rule_code)
215215

216216
@pytest.mark.slow
217217
def test_line_plot_datetime_series(self):
@@ -221,7 +221,8 @@ def test_line_plot_datetime_series(self):
221221
@pytest.mark.slow
222222
def test_line_plot_period_frame(self):
223223
for df in self.period_df:
224-
_check_plot_works(df.plot, df.index.freq)
224+
freq = df.index.asfreq(df.index.freq.rule_code).freq
225+
_check_plot_works(df.plot, freq)
225226

226227
@pytest.mark.slow
227228
def test_line_plot_datetime_frame(self):

0 commit comments

Comments
 (0)