Skip to content

.dt error when handling Series across daylight savings boundary #11648

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
nasrallah opened this issue Nov 19, 2015 · 2 comments
Closed

.dt error when handling Series across daylight savings boundary #11648

nasrallah opened this issue Nov 19, 2015 · 2 comments
Labels
Duplicate Report Duplicate issue or pull request

Comments

@nasrallah
Copy link

import pandas as pd
## two timepoints in UTC flanking the US/Eastern DST shift
date_strings = ['2015-11-01T05:00:00Z', '2015-11-01T07:00:00Z']
S = pd.Series(date_strings)
## Convert to US/Eastern 
S = pd.to_datetime(S).apply(lambda x: x.tz_localize('UTC').tz_convert('US/Eastern'))
S.dt.dayofweek
## AttributeError: Can only use .dt accessor with datetimelike values

## Note: the problem does not arise if the US/Eastern version of the times are on different days
## e.g. if date_strings = ['2015-11-01T03:00:00Z', '2015-11-01T07:00:00Z']

Using python 3.4 and pandas 0.17.0.
When a Series contains two time-zone aware datetimes on the 'same day' in the local time zone on either side of the Fall 2015 daylight savings time shift, calling .dt produces an attribute error.

@jorisvandenbossche
Copy link
Member

This works in master, and this was probably fixed by #11301 (so it will be fixed in 0.17.1, to be released this weekend)

@jorisvandenbossche jorisvandenbossche added the Duplicate Report Duplicate issue or pull request label Nov 19, 2015
@jorisvandenbossche
Copy link
Member

But thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants