Dateutils (pynance.dateutils)

New in version 0.5.0.

Utility functions for working with dates.

pynance.dateutils.is_bday(date, bday=None)[source]

Return true iff the given date is a business day.

Parameters:

date : pandas.Timestamp

Any value that can be converted to a pandas Timestamp–e.g., ‘2012-05-01’, dt.datetime(2012, 5, 1, 3)

bday : pandas.tseries.offsets.CustomBusinessDay

Defaults to CustomBusinessDay(calendar=USFederalHolidayCalendar()). Pass this parameter in performance-sensitive contexts, such as when calling this function in a loop. The creation of the CustomBusinessDay object is the performance bottleneck of this function. Cf. pandas.tseries.offsets.CustomBusinessDay.

Returns:

val : bool

True iff date is a business day