I am trying to get the data frame time index as a series, but it seems to drop the timezone when I call the to_series method. The following is an example. Is this a mistake or am I doing something wrong?
rows = 50
df = pd.DataFrame(np.random.randn(rows,2), columns=list('AB'), index=pd.date_range('1/1/2000', periods=rows, freq='1H', tz=pytz.UTC))
print df.index[-1]
print df.index.to_series()[-1]
print df.index[-1].tzinfo
print df.index.to_series()[-1].tzinfo
source
share