pydata/pandas — pull request #3744 by snth (2013-06-03 14:01:05+00:00)
Title: ENH: Experimental CustomBusinessDay DateOffset class. fixes #2301

I took a stab at issue #2301 using the busdaycalendar functionality in numpy 1.7.

### Caveats

There are a few issues with this:
* It requires Numpy 1.7 (I've only tested it on numpy 1.7.1).
* The timezone handling in nump 1.7 is broken (according to [this discussion](http://numpy-discussion.10968.n7.nabble.com/timezones-and-datetime64-td33407.html) ) and the datetime64 and timezone API will change in numpy 1.8. So from what I understand the current code as I've written it might move you onto a different day if you're in a UTC-0?00 timezone (I'm in UTC+0200 so it didn't affect me).

That said I didn't want to reinvent the wheel and since the numpy datetime64 api does cater for this usecase I thought it would be good to standardise on that in the long term.

The code does what I need it to do and I'm putting it out there in case it's useful to anyone else. Also, with some feedback maybe we can get it to the point where it could be included in Pandas as an optional DateOffset class for users who have Numpy 1.7.

### Possible Improvements

I can think of:
* Guard in the constructor to raise a meaningful exception when the user doesn't is on Numpy < 1.7.
* Better handling for the timezone issue.
* Unit tests for the CustomBusinessDay behaviour.

### Notes

* I picked the frequency code 'C' because it was available and fit nicely between 'D' and 'B'. I had originally named the class TradingDay and wanted to use 'T' but that's already used for Minutes.
* I have no idea what goes on in frequencies.py and I simply put a 'C' wherever I found a 'B' using the reasoning that as a BusinessDay subclass it should work in all the same places.