File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -262,7 +262,7 @@ def _get_index_freq(data):
262
262
def _maybe_convert_index (ax , data ):
263
263
# tsplot converts automatically, but don't want to convert index
264
264
# over and over for DataFrames
265
- if isinstance (data .index , ABCDatetimeIndex ):
265
+ if isinstance (data .index , ( ABCDatetimeIndex , ABCPeriodIndex ) ):
266
266
freq = getattr (data .index , 'freq' , None )
267
267
268
268
if freq is None :
@@ -279,7 +279,10 @@ def _maybe_convert_index(ax, data):
279
279
freq = get_base_alias (freq )
280
280
freq = frequencies .get_period_alias (freq )
281
281
282
- data = data .to_period (freq = freq )
282
+ if isinstance (data .index , ABCDatetimeIndex ):
283
+ data = data .to_period (freq = freq )
284
+ elif isinstance (data .index , ABCPeriodIndex ):
285
+ data .index = data .index .asfreq (freq )
283
286
return data
284
287
285
288
You can’t perform that action at this time.
0 commit comments