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 cb797e7 commit f765a91Copy full SHA for f765a91
pandas/plotting/_matplotlib/timeseries.py
@@ -251,7 +251,11 @@ def _maybe_convert_index(ax, data):
251
freq = frequencies.get_period_alias(freq)
252
253
if isinstance(data.index, ABCDatetimeIndex):
254
- data = data.tz_localize(None).to_period(freq=freq)
+ if data.index.tz is not None:
255
+ data = data.tz_convert(None).to_period(freq=freq)
256
+ else:
257
+ # can't convert tz-naive
258
+ data = data.to_period(freq=freq)
259
elif isinstance(data.index, ABCPeriodIndex):
260
data.index = data.index.asfreq(freq=freq)
261
return data
0 commit comments