Calendar.split#

Calendar.split(on=None, side: str = 'left', starting: date = None, ending: date = None)#

Splits the calendar at the given business day, assuming that the passed index is the first (or last) date of each period.

Parameters:
  • on (BD) – the business day on which to split

  • side ({'left','right'}) – whether to start or end each period on the split

  • starting (BD) – the business day on which to split (with side left)

  • ending (BD) – the business day on which to split (with side right)

Returns:

The collection of calendars each starting or ending on the given business day

Return type:

Collection

Example

Split the calendar on the 10th business day each month

>>> from doubledate import BD
>>> calendar = Calendar(dates)
>>> calendar.split(BD(10, "M"))
<doubledate.Collection at 0x7fd0fa52c2e0>

Split the calendar on the penultimate day each quarter

>>> calendar.split(BD(-2, "Y"))
<doubledate.Collection at 0x7fd0fa52c2e0>

See also

Calendar.groupby

Split the calendar on a criteria