I've received some good feedback from Chuck and Ralf on the code and documentation, respectively, and build testing with proposed fixes for issues from the previous merge from Derek. I believe the current set of changes are in good shape to merge, so would like to proceed with that later today.
Cheers, Mark On Tue, Jun 14, 2011 at 6:34 PM, Mark Wiebe <[email protected]> wrote: > These functions are now fully implemented and documented. As always, code > reviews are welcome here: > > https://github.com/numpy/numpy/pull/87 > > and for those that don't want to dig into review C code, the commit for the > documentation is here: > > > https://github.com/m-paradox/numpy/commit/6b5a42a777b16812e774193b06da1b68b92bc689 > > This is probably also another good place to do a merge to master, so if > people could test it on Mac/Windows/other platforms that would be much > appreciated. > > Thanks, > Mark > > On Fri, Jun 10, 2011 at 5:49 PM, Mark Wiebe <[email protected]> wrote: > >> I've implemented the busday_offset function with support for the weekmask >> and roll parameters, the commits are tagged 'datetime-bday' in the pull >> request here: >> >> https://github.com/numpy/numpy/pull/87 >> >> -Mark >> >> >> On Thu, Jun 9, 2011 at 5:23 PM, Mark Wiebe <[email protected]> wrote: >> >>> Here's a possible design for a business day API for numpy datetimes: >>> >>> >>> The 'B' business day unit will be removed. All business day-related >>> calculations will be done using the 'D' day unit. >>> >>> A class *BusinessDayDef* to encapsulate the definition of the business >>> week and holidays. The business day functions will either take one of these >>> objects, or separate weekmask and holidays parameters, to specify the >>> business day definition. This class serves as both a performance >>> optimization and a way to encapsulate the weekmask and holidays together, >>> for example if you want to make a dictionary mapping exchange names to their >>> trading days definition. >>> >>> The weekmask can be specified in a number of ways, and internally becomes >>> a boolean array with 7 elements with True for the days Monday through Sunday >>> which are valid business days. Some different notations are for the 5-day >>> week include [1,1,1,1,1,0,0], "1111100" "MonTueWedThuFri". The holidays are >>> always specified as a one-dimensional array of dtype 'M8[D]', and are >>> internally used in sorted form. >>> >>> >>> A function *is_busday*(datearray, weekmask=, holidays=, busdaydef=) >>> returns a boolean array matching the input datearray, with True for the >>> valid business days. >>> >>> A function *busday_offset*(datearray, offsetarray, >>> roll='raise', weekmask=, holidays=, busdaydef=) which first applies the >>> 'roll' policy to start at a valid business date, then offsets the date by >>> the number of business days specified in offsetarray. The arrays datearray >>> and offsetarray are broadcast together. The 'roll' parameter can be >>> 'forward'/'following', 'backward'/'preceding', 'modifiedfollowing', >>> 'modifiedpreceding', or 'raise' (the default). >>> >>> A function *busday_count*(datearray1, datearray2, weekmask=, holidays=, >>> busdaydef=) which calculates the number of business days between datearray1 >>> and datearray2, not including the day of datearray2. >>> >>> >>> For example, to find the first Monday in Feb 2011, >>> >>> >>>np.busday_offset('2011-02', 0, roll='forward', weekmask='Mon') >>> >>> or to find the number of weekdays in Feb 2011, >>> >>> >>>np.busday_count('2011-02', '2011-03') >>> >>> This set of three functions appears to be powerful enough to express the >>> business-day computations that I've been shown thus far. >>> >>> Cheers, >>> Mark >>> >> >> >
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
