Skip to content
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

weekofyear gives different results on a DatetimeIndex (if tz is given) #6538

Closed
sdementen opened this issue Mar 4, 2014 · 1 comment · Fixed by #16181
Closed

weekofyear gives different results on a DatetimeIndex (if tz is given) #6538

sdementen opened this issue Mar 4, 2014 · 1 comment · Fixed by #16181
Labels
Bug Timezones Timezone data dtype
Milestone

Comments

@sdementen
Copy link
Contributor

Hello,

The following code

dates = ["2013/12/29", "2013/12/30", "2013/12/31"]
dates = pandas.DatetimeIndex(dates, tz="Europe/Brussels")
print dates.weekofyear
print [d.weekofyear for d in dates]

gives

[52  1  1]
[52, 52, 1]

i.e. calling weekofyear on the datetimeindex directly or iterating on the different dates of the datetimeindex gives different results.

Notice that if we remove the tz in the DatetimeIndex, the results are consistant.

Sébastien

@jreback
Copy link
Contributor

jreback commented Mar 4, 2014

seems some kind of bug in the cython-code. want to dig in?
(and no real tests of this in any event)
https://github.com/pydata/pandas/blob/master/pandas/tslib.pyx#L2212

this takes input of the UTC i8 representation (e.g. the nanoseconds from epoch), like Timestamp(....).value) but as an array of dtype 'i8'

@jreback jreback added this to the 0.14.0 milestone Mar 4, 2014
@jreback jreback modified the milestones: 0.15.0, 0.14.0 Apr 9, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 3, 2015
@jreback jreback modified the milestones: 0.20.0, Next Major Release May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Timezones Timezone data dtype
Projects
None yet
2 participants