pandas.tseries.offsets.BusinessDay#
- class pandas.tseries.offsets.BusinessDay(n=1, normalize=False, offset=datetime.timedelta(0))#
DateOffset subclass representing possibly n business days.
BusinessDay, also known as BDay, is a date offset representing a single business day or a number of business days. Business days exclude weekends (Saturday and Sunday) by default.
- Parameters:
- nint, default 1
The number of days represented.
- normalizebool, default False
Normalize start/end dates to midnight.
- offsettimedelta, default timedelta(0)
Additional time offset applied after the business day calculation.
Attributes
Return the time offset applied to the business day.
Return the holidays used for custom business day calculations.
Return the calendar used for business day calculations.
Return the weekmask used for custom business day calculations.
See also
DateOffsetStandard kind of date increment.
Examples
You can use the parameter
nto represent a shift of n business days.>>> ts = pd.Timestamp(2022, 12, 9, 15) >>> ts.strftime('%a %d %b %Y %H:%M') 'Fri 09 Dec 2022 15:00' >>> (ts + pd.offsets.BusinessDay(n=5)).strftime('%a %d %b %Y %H:%M') 'Fri 16 Dec 2022 15:00'
Passing the parameter
normalizeequal to True, you shift the start of the next business day to midnight.>>> ts = pd.Timestamp(2022, 12, 9, 15) >>> ts + pd.offsets.BusinessDay(normalize=True) Timestamp('2022-12-12 00:00:00')