Pandas plot function ignores timezone of timeseries
pandas, python
Solution
This is definitely a bug. I've created a report on github. The reason is because internally, pandas converts a regular frequency DatetimeIndex to PeriodIndex to hook into formatters/locators in pandas, and currently PeriodIndex does NOT retain timezone information. Please stay tuned for a fix.
Problem
When plotting a timeseries with the built-in plot function of pandas, it seems to ignore the timezone of my index: it always uses the UTC time for the x-axis. An example: ``` import numpy as np import matplotlib.pyplot as plt from pandas import rolling_mean, DataFrame, date_range rng = date_range('1/1/2011', periods=200, freq='S', tz="UTC") data = DataFrame(np.random.randn(len(rng), 3), index=rng, columns=['A', 'B', 'C']) data_cet = data.tz_convert("CET") # plot with data in UTC timezone fig, ax = plt.subplots() data[["A", "B"]].plot(ax=ax, grid=True) plt.show() # plot with data in CET timezone, but the x-axis remains the same as above fig, ax = plt.subplots() data_cet[["A", "B"]].plot(ax=ax, grid=True) plt.show() ``` The plot does not change, although the index has: ``` In [11]: data.index[0] Out[11]: <Timestamp: 2011-01-01 00:00:00+0000 UTC, tz=UTC> In [12]: data_cet.index[0] Out[12]: <Timestamp: 2011-01-01 01:00:00+0100 CET, tz=CET> ``` Should I file a bug, or do I miss something?