Collection#

class doubledate.calendar.Collection(calendars)#

Collection of calendars.

Collections are normally generated from splitting a Calendar in several periods via resampling or grouping

Example

>>> import datetime
>>> import doubledate as dtwo

>>> holidays = [
...     datetime.date(2022, 1, 17),
...     datetime.date(2022, 5, 30),
...     datetime.date(2022, 6, 4),
...     datetime.date(2022, 9, 5),
...     datetime.date(2022, 11, 11),
...     datetime.date(2022, 12, 24),
...     datetime.date(2022, 12, 26)
... ]

>>> calendar = dtwo.Calendar(holidays).inverse().weekdays()
>>> calendar
<doubledate.Calendar>

>>> calendar.resample("M") #split the calendar by month
<doubledate.Collection>

>>> calendar.resample("M").nth(10, base=1) #get the 10th business day each month
<doubledate.Calendar>