Skip to content

Indexing/Slicing tz-aware TimeSeries fails when using datetime #2575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
timtroendle opened this issue Dec 21, 2012 · 1 comment
Closed

Indexing/Slicing tz-aware TimeSeries fails when using datetime #2575

timtroendle opened this issue Dec 21, 2012 · 1 comment
Labels
Milestone

Comments

@timtroendle
Copy link

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.

@wesm
Copy link
Member

wesm commented Dec 25, 2012

I see, thanks. Marked as a bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants