bundles / numpy 2.4.3 / numpy / busdaycalendar
class
numpy:busdaycalendar
source: /numpy/__init__.py
Signature
class busdaycalendar ( weekmask = 1111100 , holidays = None ) Summary
A business day calendar object that efficiently stores information defining valid days for the busday family of functions.
Extended Summary
The default valid days are Monday through Friday ("business days"). A busdaycalendar object can be specified with any set of weekly valid days, plus an optional "holiday" dates that always will be invalid.
Once a busdaycalendar object is created, the weekmask and holidays cannot be modified.
Parameters
weekmask: str or array_like of bool, optionalA seven-element array indicating which of Monday through Sunday are valid days. May be specified as a length-seven list or array, like [1,1,1,1,1,0,0]; a length-seven string, like '1111100'; or a string like "Mon Tue Wed Thu Fri", made up of 3-character abbreviations for weekdays, optionally separated by white space. Valid abbreviations are: Mon Tue Wed Thu Fri Sat Sun
holidays: array_like of datetime64[D], optionalAn array of dates to consider as invalid dates, no matter which weekday they fall upon. Holiday dates may be specified in any order, and NaT (not-a-time) dates are ignored. This list is saved in a normalized form that is suited for fast calculations of valid days.
Attributes
weekmask: (copy) seven-element array of boolholidays: (copy) sorted array of datetime64[D]
Returns
out: busdaycalendarA business day calendar object containing the specified weekmask and holidays values.
Notes
Once a busdaycalendar object is created, you cannot modify the weekmask or holidays. The attributes return copies of internal data.
Examples
import numpy as np # Some important days in July bdd = np.busdaycalendar( holidays=['2011-07-01', '2011-07-04', '2011-07-17']) # Default is Monday to Friday weekdays bdd.weekmask # Any holidays already on the weekend are removed bdd.holidays✓
See also
- busday_count
Counts how many valid days are in a half-open date range.
- busday_offset
Applies an offset counted in valid days.
- is_busday
Returns a boolean array indicating valid days.
Aliases
-
numpy.busdaycalendar