Skip to content

Cannot Add Dates that are the 1st of a Month and on a Sunday to a DatetimeIndex #5348

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
jeffshek opened this issue Oct 27, 2013 · 3 comments · Fixed by #14853
Closed

Cannot Add Dates that are the 1st of a Month and on a Sunday to a DatetimeIndex #5348

jeffshek opened this issue Oct 27, 2013 · 3 comments · Fixed by #14853
Labels
Bug Frequency DateOffsets

Comments

@jeffshek
Copy link

Running into a problem when I attempt to add the first date of a month that is a Sunday.

import datetime
from pandas.tseries.index import DatetimeIndex

d1 = datetime.date(2002, 9, 1)
d2 = datetime.date(2013, 10, 27)

d3 = datetime.date(2012, 9, 30)

i1 = DatetimeIndex([d1, d2])
i2 = DatetimeIndex([d3])

i1 + i2

ValueError: Could not evaluate WOM-1SUN

Returns a ValueError "Could not evaluate WOM-1SUN". However, if I change d1 and then follow the same steps

d1 = datetime.date(2002, 9, 2)
i1 = DatetimeIndex([d1, d2])
i1 + i2

Out[2]: <class 'pandas.tseries.index.DatetimeIndex'>
[2002-09-02 00:00:00, ..., 2013-10-27 00:00:00]
Length: 3, Freq: None, Timezone: None

This create a DatetimeIndex adding the the index i1 and i2.

@cancan101
Copy link
Contributor

This is caused by two issues: #5115 and and #5152

@jreback jreback modified the milestones: 0.15.0, 0.14.0 Feb 18, 2014
@jeffshek
Copy link
Author

Since some of the underlying has fixed for the example above (while understanding that the full fix is for a future release). Providing an additional scenario that still showcases this in 15.2 (if helpful)

d1 = datetime.date(2014, 3, 31)
d2 = datetime.date(2014, 6, 30)
d3 = datetime.date(2014, 12, 29)

i1 = DatetimeIndex([d1, d2])
i2 = DatetimeIndex([d3])

i1 + i2
ValueError: Could not evaluate WOM-5MON

@jreback
Copy link
Contributor

jreback commented Jan 2, 2015

hmm, that is a weird error. I'll mark as a bug. pull-requests welcome!

@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
@jorisvandenbossche jorisvandenbossche removed this from the Next Major Release milestone Dec 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Frequency DateOffsets
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants