-
- Notifications
You must be signed in to change notification settings - Fork 19.2k
Closed
Description
The following code should clarify the problem:
import pandas import pytz index = pandas.date_range(start='2012-12-24 16:00', end='2012-12-24 18:00', freq='H', tz='Europe/Berlin') ts = pandas.TimeSeries(index=index, data=index.hour) time_pandas = pandas.Timestamp('2012-12-24 17:00', tz='Europe/Berlin') time_datetime = datetime.datetime(2012,12,24,17,00, tzinfo=pytz.timezone('Europe/Berlin')) time_pandas == time_datetime ts[time_pandas] == ts[time_datetime]While the two time stamps are equal, using them as an index on the TimeSeries results in different values. The same is true for slicing.
When using a tz-aware datetime for indexing/slicing, pandas seems to remove the timezone and interprete the time stamp as UTC.