Skip to content

ENH: BusinessHour to support multiple opening and closing times per day #15481

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
jzwinck opened this issue Feb 23, 2017 · 3 comments · Fixed by #26628
Closed

ENH: BusinessHour to support multiple opening and closing times per day #15481

jzwinck opened this issue Feb 23, 2017 · 3 comments · Fixed by #26628
Labels
Milestone

Comments

@jzwinck
Copy link
Contributor

jzwinck commented Feb 23, 2017

BusinessHour supports arbitrary start and end times. But some businesses open and close more than once per day. Some examples:

  • Restaurants, who might want to analyze foot traffic or revenue, but excluding times they don't open.
  • Stock markets, several of which have a lunch break.
  • Mexico, where standard business hours are 07:00-14:00 and 16:00-18:00.

Many use cases could be satisfied by just two opens and two closes per day, but it might be just as well to support any amount.

@jreback
Copy link
Contributor

jreback commented Feb 23, 2017

can you give a pseudo code example of how this would work? (constructor, usage, etc), compared to using just one o/c

@jzwinck
Copy link
Contributor Author

jzwinck commented Feb 24, 2017

It could be done using arrays or lists for start and end in the BusinessHour and CustomBusinessHour constructors. For example:

mexico_hour = BusinessHour(start=['07:00', '16:00'], end=['14:00', '18:00'])

Or it could be done using a single 2D set of start and end times:

mexico_hour = BusinessHour(open=[['07:00', '14:00'], ['16:00', '18:00']])

Personally I'd be happy with either. Once constructed, usage should be exactly the same. For example if I add one mexico_hour to 2017-02-23 13:30 I would expect to get 2017-02-23 16:30, and if I add seven hours I would expect to get 2017-02-24 11:30.

@jreback jreback added this to the Next Major Release milestone Feb 24, 2017
@jreback
Copy link
Contributor

jreback commented Feb 24, 2017

ok doesn't seem unreasonable. I had a brief look at the current impl. It does seem that this could be done in a back-compat way, though might be some semantic confusions, e.g. since open can now occur multiple times per day.

so would take a community PR to do this!

@sinhrks

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