Preconfigured calendars

Russia

class timeboard.calendars.RU.Weekly8x5

Russian official calendar for 5 days x 8 hours working week.

Workshifts are calendar days. Workshift labels are the number of working hours per day: 0 for days off, 8 for regular business days, 7 for some pre- or post-holiday business days (see also short_eves parameter).

Parameters:
custom_start : Timestamp-like, optional

Change the first date of the calendar. This date must be within the default calendar range returned by Weekly8x5.parameters(). By default, the calendar starts on the date defined by ‘start’ element of Weekly8x5.parameters().

custom_end : Timestamp-like, optional

Change the last date of the calendar. This date must be within the default calendar range returned by Weekly8x5.parameters(). By default, the calendar ends on the date defined by ‘end’ element of Weekly8x5.parameters().

do_not_amend : bool, optional (default False)

If set to True, the calendar is created without any amendments, meaning that effects of holiday observations are not accounted for.

only_custom_amendments : bool, optional (default False)

If set to True, only amendments from custom_amendments are applied to the calendar.

custom_amendments : dict-like

The alternative amendments if only_custom_amendments is true. Otherwise, custom_amendments are used to update pre-configured amendments (add missing or override existing amendments).

work_on_dec31 : bool, optional (default True)

If False, the December 31 is always considered a holiday. Otherwise use the official status of each December 31, which is the default behavior.

short_eves : bool, optional (default True)

If False, consider all business days having 8 working hours. Otherwise assume the official reduction of the working day to 7 hours on some pre- or post-holiday business days, which is the default behavior.

Returns:
Timeboard
Raises:
OutOfBoundsError

If custom_start or custom_end fall outside the calendar range returned by Weekly8x5.parameters()

Examples

>>> import timeboard.calendars.RU as RU

Create an official business calendar for the available range of dates:

>>> clnd = RU.Weekly8x5()

Create a business calendar for years 2010-2017, ignoring short eves and making December 31 always a day off:

>>> clnd = RU.Weekly8x5(custom_start='01 Jan 2010', 
...                     custom_end='31 Dec 2017', 
...                     work_on_dec31 = False,
...                     short_eves = False)

Inspect the default calendar range:

>>> params = RU.Weekly8x5.parameters()
>>> params['start']
Timestamp('2005-01-01 00:00:00')
>>> params['end']
Timestamp('2018-12-31 23:59:59')

Methods

parameters() (dict) This class method returns a dictionary of Timeboard parameters used for building the calendar.

United Kingdom

class timeboard.calendars.UK.Weekly8x5

British business calendar for 5 days x 8 hours working week.

The calendar takes into account the bank holidays (https://www.gov.uk/bank-holidays) with regard to the country within the UK. Selected holidays can be ignored by adding them to exclusions.

Workshifts are calendar days. Workshift labels are the number of working hours per day: 0 for days off, 8 for business days.

Parameters:
custom_start : Timestamp-like, optional

Change the first date of the calendar. This date must be within the default calendar range returned by Weekly8x5.parameters(). By default, the calendar starts on the date defined by ‘start’ element of Weekly8x5.parameters().

custom_end : Timestamp-like, optional

Change the last date of the calendar. This date must be within the default calendar range returned by Weekly8x5.parameters(). By default, the calendar ends on the date defined by ‘end’ element of Weekly8x5.parameters().

do_not_amend : bool, optional (default False)

If set to True, the calendar is created without any amendments, meaning that effects of holiday observations are not accounted for.

only_custom_amendments : bool, optional (default False)

If set to True, only amendments from custom_amendments are applied to the calendar.

only_custom_amendments : bool, optional (default False)

If set to True, only amendments from custom_amendments are applied to the calendar.

custom_amendments : dict-like

The alternative amendments if only_custom_amendments is true. Otherwise, custom_amendments are used to update pre-configured amendments (add missing or override existing amendments).

country : {'england', 'northern_ireland', 'scotland'}, optional

The default is 'england' for England and Wales.

do_not_observe : set, optional

Holidays to be ignored. The following values are accepted into the set: 'new_year', 'new_year2' (for the 2nd of January), 'st_patricks', 'good_friday', 'easter_monday', 'early_may', 'spring', 'orangemens' (for Battle of the Boyne Day on July 12), 'st_andrews', 'christmas', 'boxing', 'royal' (for one-off celebrations in the royal family).

long_weekends : bool, optional (default True)

If false, do not extend weekends if a holiday falls on Saturday or Sunday.

Returns:
Timeboard
Raises:
OutOfBoundsError

If custom_start or custom_end fall outside the calendar range returned by Weekly8x5.parameters()

Examples

>>> import timeboard.calendars.UK as UK

Create an official business calendar for the available range of dates:

>>> clnd = UK.Weekly8x5()

Create a 2010-2017 business calendar for Scotland but don’t observe St Andrew’s Day:

>>> clnd = UK.Weekly8x5(custom_start='01 Jan 2010', 
...                     custom_end='31 Dec 2017', 
...                     country = 'scotland',
...                     do_not_observe = {'st_andrews'})

Inspect the default calendar range:

>>> params = UK.Weekly8x5.parameters()
>>> params['start']
Timestamp('2000-01-01 00:00:00')
>>> params['end']
Timestamp('2019-12-31 23:59:59')

Methods

parameters() (dict) This class method returns a dictionary of Timeboard parameters used for building the calendar.

United States

class timeboard.calendars.US.Weekly8x5

US business calendar for 5 days x 8 hours working week.

The calendar takes into account the federal holidays. The Black Friday is also considered a holiday. Selected holidays can be ignored by adding them to exclusions.

Workshifts are calendar days. Workshift labels are the number of working hours per day: 0 for days off, 8 for business days.

Parameters:
custom_start : Timestamp-like, optional

Change the first date of the calendar. This date must be within the default calendar range returned by Weekly8x5.parameters(). By default, the calendar starts on the date defined by ‘start’ element of Weekly8x5.parameters().

custom_end : Timestamp-like, optional

Change the last date of the calendar. This date must be within the default calendar range returned by Weekly8x5.parameters(). By default, the calendar ends on the date defined by ‘end’ element of Weekly8x5.parameters().

do_not_amend : bool, optional (default False)

If set to True, the calendar is created without any amendments, meaning that effects of holiday observations are not accounted for.

only_custom_amendments : bool, optional (default False)

If set to True, only amendments from custom_amendments are applied to the calendar.

custom_amendments : dict-like

The alternative amendments if only_custom_amendments is true. Otherwise, custom_amendments are used to update pre-configured amendments (add missing or override existing amendments).

do_not_observe : set, optional

Holidays to be ignored. The following values are accepted into the set: 'new_year', 'mlk' for Martin Luther King Jr. Day, 'presidents', 'memorial', 'independence', 'labor', 'columbus', 'veterans', 'thanksgiving', 'black_friday', 'christmas', 'xmas_additional_day' for Christmas Eve or the day after Christmas in certain years only, 'one_off' for one-off events such as State funeral of George W. Bush senior in 05 Dec 2018.

long_weekends : bool, optional (default True)

If false, do not extend weekends if a holiday falls on Saturday or Sunday.

Returns:
Timeboard
Raises:
OutOfBoundsError

If custom_start or custom_end fall outside the calendar range returned by Weekly8x5.parameters()

Examples

>>> import timeboard.calendars.US as US

Create an official business calendar for the available range of dates:

>>> clnd = US.Weekly8x5()

Create a 2010-2017 business calendar with Black Friday a working day:

>>> clnd = US.Weekly8x5(custom_start='01 Jan 2010', 
...                     custom_end='31 Dec 2017', 
...                     do_not_observe = {'black_friday'})

Inspect the default calendar range:

>>> params = US.Weekly8x5.parameters()
>>> params['start']
Timestamp('2000-01-01 00:00:00')
>>> params['end']
Timestamp('2020-12-31 00:00:00')

Methods

parameters() (dict) This class method returns a dictionary of Timeboard parameters used for building the calendar.