Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Annual Holiday with no offset or observance #7987
Comments
MichaelWS
referenced
this issue
Aug 11, 2014
Merged
bug fix for 7987 and add day of week functionality to Holiday #7988
jreback
added Bug Frequency
labels
Aug 11, 2014
jreback
added this to the
0.15.0
milestone
Aug 11, 2014
|
Is this only observed when July 3rd is a weekday? |
|
yes. |
|
July 3rd is only an observed half holiday though and only if July 4th is not observed |
|
but there are a lot of world holidays that work like this |
|
July 3rd is observed Monday Through Thursday |
|
it's pretty specifc and tied to trading holidays |
|
Right, so the way the rule is now isn't right (it would be every july 3rd). There's needs to be an observance (mon-thurs) and not the other days (we don't have this capability right now). We could do something like observance = [MTWRFSU] for days of the week. Or have an offset be a Holiday object and a rule relative to that, but you would still have observance issues. |
|
Well, what my solution was for this is to maintain a list of holidays and early_closes and remove early_closes that are holidays. |
|
need a concept of a relative holiday for this one that is dependent on another holiday (need to create this type of functionality) maybe a DependentHoliday (or can just pass it as another argument) |
|
what functionality would be needed besides this? Should we add day of week functionality? |
|
Also, would I be ok to remove Nones from dates? I want to observe to Tokyo using a function that moves Sundays to Mondays and drops Saturdays |
|
Let's take your July 3rd example. So it would be a DependentHoliday(HolidayJuly4th, offset=Day(-1), observance=?). However, if by making it dependent on July 4th holidays only show up during the week, then we may get the Mon-Thu observance for free. What if July 4th is on a Monday? We may want to implement the day of week functionality as I can see examples where it is probably useful. I think it would be fine to remove None from dates...I don't know what they would mean. |
|
if July 4th is on a Monday, July 3rd is not observed on Friday. |
|
I implemented day of week functionality. is a tuple fine (0,1,2,3,4,5)? |
|
Yes, that is definitely more natural given how python treats day of week in datetime |
|
ok, good enough. can I add it to my bug fix Pr? |
|
sure |
MichaelWS commentedAug 11, 2014
if observance is None and offset is None, Holiday breaks when Timestamp is added to None. This was a bug in the 0.14.1 before a recent PR. I will issue a pr for this shortly.
Example:
July 3rd is a nyse exchange early close that is observed only on July 3rd.